diff --git a/electrum/transaction.py b/electrum/transaction.py index abbd247ca..57753ca25 100644 --- 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 index d1fa0b88c..7dac7e19d 100644 --- 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():