tdon't change fee if it is fixed by user - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 01ad103c37ce53e4dc4126dcae6a9cd3f6a8d060 DIR parent bd6f21232d7e627dec295fc27f1a4fa00c1c141a HTML Author: ThomasV <thomasv@gitorious> Date: Mon, 8 Sep 2014 09:29:25 +0200 don't change fee if it is fixed by user Diffstat: M lib/wallet.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -759,12 +759,16 @@ class Abstract_Wallet(object): # if change is above dust threshold, add a change output. change_amount = total - ( amount + fee ) - if change_amount > DUST_THRESHOLD: + if fixed_fee is not None: + # Insert the change output at a random position in the outputs + posn = random.randint(0, len(tx.outputs)) + tx.outputs[posn:posn] = [( 'address', change_addr, change_amount)] + elif change_amount > DUST_THRESHOLD: # Insert the change output at a random position in the outputs posn = random.randint(0, len(tx.outputs)) tx.outputs[posn:posn] = [( 'address', change_addr, change_amount)] # recompute fee including change output - fee = fixed_fee if fixed_fee is not None else self.estimated_fee(tx) + fee = self.estimated_fee(tx) # remove change output tx.outputs.pop(posn) # if change is still above dust threshold, re-add change output.