mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-11 13:09:52 +00:00
TxOutput usage: trivial clean-up
This commit is contained in:
parent
c7a8540d06
commit
5effaaf428
2 changed files with 4 additions and 4 deletions
|
@ -1043,7 +1043,7 @@ class Transaction:
|
||||||
return sum(x['value'] for x in self.inputs())
|
return sum(x['value'] for x in self.inputs())
|
||||||
|
|
||||||
def output_value(self):
|
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):
|
def get_fee(self):
|
||||||
return self.input_value() - self.output_value()
|
return self.input_value() - self.output_value()
|
||||||
|
|
|
@ -869,17 +869,17 @@ class Abstract_Wallet(AddressSynchronizer):
|
||||||
inputs = tx.inputs()
|
inputs = tx.inputs()
|
||||||
outputs = tx.outputs()
|
outputs = tx.outputs()
|
||||||
# use own 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
|
# ... unless there is none
|
||||||
if not s:
|
if not s:
|
||||||
s = outputs
|
s = outputs
|
||||||
x_fee = run_hook('get_tx_extra_fee', self, tx)
|
x_fee = run_hook('get_tx_extra_fee', self, tx)
|
||||||
if x_fee:
|
if x_fee:
|
||||||
x_fee_address, x_fee_amount = 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
|
# 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:
|
for o in s:
|
||||||
i = outputs.index(o)
|
i = outputs.index(o)
|
||||||
if o.value - delta >= self.dust_threshold():
|
if o.value - delta >= self.dust_threshold():
|
||||||
|
|
Loading…
Add table
Reference in a new issue