Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/cashfusion' into cashfusion_me…
Browse files Browse the repository at this point in the history
…rge_test
  • Loading branch information
EchterAgo committed Jul 29, 2020
2 parents b95bbf0 + 7fe2b8f commit a27cf47
Show file tree
Hide file tree
Showing 54 changed files with 9,209 additions and 361 deletions.
2 changes: 2 additions & 0 deletions contrib/build-wine/deterministic.spec
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ a = Analysis([home+'electron-cash',
home+'plugins/keepkey/qt.py',
home+'plugins/ledger/qt.py',
home+'plugins/satochip/qt.py', # Satochip
home+'plugins/fusion/fusion.py', # CashFusion
home+'plugins/fusion/qt.py', # CashFusion
#home+'packages/requests/utils.py'
],
binaries=binaries,
Expand Down
2 changes: 2 additions & 0 deletions contrib/osx/osx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ a = Analysis([home+MAIN_SCRIPT,
home+'plugins/keepkey/qt.py',
home+'plugins/ledger/qt.py',
home+'plugins/satochip/qt.py', # Satochip
home+'plugins/fusion/fusion.py', # CashFusion
home+'plugins/fusion/qt.py', # CashFusion
],
binaries=binaries,
datas=datas,
Expand Down
321 changes: 46 additions & 275 deletions gui/qt/main_window.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PACKAGE_VERSION = '4.0.15' # version of the client package
PACKAGE_VERSION = '4.1.0' # version of the client package
PROTOCOL_VERSION = '1.4' # protocol version requested

# The hash of the Electrum mnemonic seed must begin with this
Expand Down
39 changes: 33 additions & 6 deletions lib/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,26 +1831,53 @@ def make_unsigned_transaction(self, inputs, outputs, config, fixed_fee=None, cha
if i_max is None:
# Let the coin chooser select the coins to spend

change_addrs = []
if change_addr:
change_addrs = [change_addr]
else:
# Currently the only code that uses this hook is the deprecated
# Cash Shuffle plugin
change_addrs = run_hook("get_change_addrs", self) or []

if not change_addrs:
# hook gave us nothing, so find a change addr from the change
# reservation subsystem
max_change = self.max_change_outputs if self.multiple_change else 1
if self.use_change:
change_addrs = self.get_default_change_addresses(
self.max_change_outputs if self.multiple_change else 1)
change_addrs = self.get_default_change_addresses(max_change)
else:
change_addrs = []

if not change_addrs:
# For some reason we couldn't get any autogenerated
# change address (non-deterministic wallet?). So,
# try to find an input address that belongs to us.
# For some reason we couldn't get any autogenerated change
# address (non-deterministic wallet?). So, try to find an
# input address that belongs to us.
for inp in inputs:
backup_addr = inp['address']
if self.is_mine(backup_addr):
change_addrs = [backup_addr]
break
else:
raise RuntimeError("Can't find a change address!")
# ok, none of the inputs are "mine" (why?!) -- fall back
# to picking first max_change change_addresses that have
# no history
change_addrs = []
for addr in self.get_change_addresses()[-self.gap_limit_for_change:]:
if self.get_num_tx(addr) == 0:
change_addrs.append(addr)
if len(change_addrs) >= max_change:
break
if not change_addrs:
# No unused wallet addresses or no change addresses.
# Fall back to picking ANY wallet address
try:
# Pick a random address
change_addrs = [random.choice(self.get_addresses())]
except IndexError:
change_addrs = [] # Address-free wallet?!
# This should never happen
if not change_addrs:
raise RuntimeError("Can't find a change address!")

assert all(isinstance(addr, Address) for addr in change_addrs)

Expand Down
1 change: 1 addition & 0 deletions plugins/fusion/Cash Fusion Logo - No Text Gray.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions plugins/fusion/Cash Fusion Logo - No Text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions plugins/fusion/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
#
# Electron Cash - a lightweight Bitcoin Cash client
# CashFusion - an advanced coin anonymizer
#
# Copyright (C) 2020 Mark B. Lundeberg
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from electroncash.i18n import _

fullname = _('CashFusion')
description = [
_('Protect your privacy and anonymize your coins (UTXOs) by shuffling them with other users of CashFusion.'),
"\n\n",
_('A commitment and anonymous announcement scheme is used so that none of the participants know the inputs nor '
'outputs of the other participants.'), " ",
_('In addition, a blame protocol is used to mitigate time-wasting denial-of-service type attacks.')
]
description_delimiter = ''
available_for = ['qt', 'cmdline']
# If default_on is set to True, this plugin is loaded by default on new installs
default_on = True
30 changes: 30 additions & 0 deletions plugins/fusion/cmdline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
#
# Electron Cash - a lightweight Bitcoin Cash client
# CashFusion - an advanced coin anonymizer
#
# Copyright (C) 2020 Mark B. Lundeberg
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from .plugin import FusionPlugin

class Plugin(FusionPlugin):
pass
Loading

0 comments on commit a27cf47

Please sign in to comment.