From 790ad54c5a79c291c32205dfdde0a8788301bb55 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Fri, 4 Feb 2022 21:24:32 -0500 Subject: [PATCH] backporting simplified dust prevention fix --- lbry/wallet/transaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/transaction.py b/lbry/wallet/transaction.py index 01948ceea..ebe62718d 100644 --- a/lbry/wallet/transaction.py +++ b/lbry/wallet/transaction.py @@ -832,10 +832,10 @@ class Transaction: ) if payment > cost: change = payment - cost - if change > cost_of_change: + change_amount = change - cost_of_change + if change_amount > 1000: change_address = await change_account.change.get_or_create_usable_address() change_hash160 = change_account.ledger.address_to_hash160(change_address) - change_amount = change - cost_of_change change_output = Output.pay_pubkey_hash(change_amount, change_hash160) change_output.is_internal_transfer = True tx.add_outputs([Output.pay_pubkey_hash(change_amount, change_hash160)])