electrum

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

commit 01ad103c37ce53e4dc4126dcae6a9cd3f6a8d060
parent bd6f21232d7e627dec295fc27f1a4fa00c1c141a
Author: ThomasV <thomasv@gitorious>
Date:   Mon,  8 Sep 2014 09:29:25 +0200

don't change fee if it is fixed by user

Diffstat:
Mlib/wallet.py | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -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.