Skip to content

Commit c0b5d97

Browse files
committed
Test that joinpsbts randomly shuffles the inputs
1 parent 6f405a1 commit c0b5d97

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/rpc_psbt.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ def test_psbt_input_keys(psbt_input, keys):
370370
joined_decoded = self.nodes[0].decodepsbt(joined)
371371
assert len(joined_decoded['inputs']) == 4 and len(joined_decoded['outputs']) == 2 and "final_scriptwitness" not in joined_decoded['inputs'][3] and "final_scriptSig" not in joined_decoded['inputs'][3]
372372

373+
# Check that joining shuffles the inputs and outputs
374+
# 10 attempts should be enough to get a shuffled join
375+
shuffled = False
376+
for i in range(0, 10):
377+
shuffled_joined = self.nodes[0].joinpsbts([psbt, psbt2])
378+
shuffled |= joined != shuffled_joined
379+
if shuffled:
380+
break
381+
assert shuffled
382+
373383
# Newly created PSBT needs UTXOs and updating
374384
addr = self.nodes[1].getnewaddress("", "p2sh-segwit")
375385
txid = self.nodes[0].sendtoaddress(addr, 7)

0 commit comments

Comments
 (0)