electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 5effaaf4281f0161ee59471c6eaf576bf2dbb683
parent c7a8540d063a6bf058c1151d2b0c8ea6d0b2ff0e
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 19 Jun 2019 21:59:49 +0200

TxOutput usage: trivial clean-up

Diffstat:
Melectrum/transaction.py | 2+-
Melectrum/wallet.py | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/electrum/transaction.py b/electrum/transaction.py @@ -1043,7 +1043,7 @@ class Transaction: return sum(x['value'] for x in self.inputs()) def output_value(self): - return sum(val for tp, addr, val in self.outputs()) + return sum(o.value for o in self.outputs()) def get_fee(self): return self.input_value() - self.output_value() diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -869,17 +869,17 @@ class Abstract_Wallet(AddressSynchronizer): inputs = tx.inputs() outputs = tx.outputs() # use own outputs - s = list(filter(lambda x: self.is_mine(x[1]), outputs)) + s = list(filter(lambda o: self.is_mine(o.address), outputs)) # ... unless there is none if not s: s = outputs x_fee = run_hook('get_tx_extra_fee', self, tx) if x_fee: x_fee_address, x_fee_amount = x_fee - s = filter(lambda x: x[1]!=x_fee_address, s) + s = filter(lambda o: o.address != x_fee_address, s) # prioritize low value outputs, to get rid of dust - s = sorted(s, key=lambda x: x[2]) + s = sorted(s, key=lambda o: o.value) for o in s: i = outputs.index(o) if o.value - delta >= self.dust_threshold():