From d6eb9fb1536953e0537366c23128f9797bd7587a Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 22 Jan 2013 18:29:37 +0900 Subject: [PATCH] Place the change output in a random position --- lib/wallet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/wallet.py b/lib/wallet.py index ca428af1..200a9a10 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -610,7 +610,9 @@ class Wallet: # normally, the update thread should ensure that the last change address is unused if not change_addr: change_addr = self.change_addresses[-1] - outputs.append( ( change_addr, change_amount) ) + # Insert the change output at a random position in the outputs + posn = random.randint(0, len(outputs)) + outputs[posn:posn] = [( change_addr, change_amount)] return outputs def sign_inputs( self, inputs, outputs, password ):