diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-08-14 14:29:55 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-09-24 07:53:29 +0800 |
commit | b12defc3bc7ba68a86c053138d29d942b81af805 (patch) | |
tree | 9a95e1bb21ee26df0c760a60e5e558b740e860ed | |
parent | eb07d22b2d3ec70203412a7746b0ec73217cc974 (diff) |
Test that joinpsbts randomly shuffles the inputs
Github-Pull: #16512
Rebased-From: c0b5d9710322a614a50ab5da081558cf6a38ad2a
-rwxr-xr-x | test/functional/rpc_psbt.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index f4152503e3..ed91c40405 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -361,6 +361,16 @@ class PSBTTest(BitcoinTestFramework): joined_decoded = self.nodes[0].decodepsbt(joined) 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] + # Check that joining shuffles the inputs and outputs + # 10 attempts should be enough to get a shuffled join + shuffled = False + for i in range(0, 10): + shuffled_joined = self.nodes[0].joinpsbts([psbt, psbt2]) + shuffled |= joined != shuffled_joined + if shuffled: + break + assert shuffled + # Newly created PSBT needs UTXOs and updating addr = self.nodes[1].getnewaddress("", "p2sh-segwit") txid = self.nodes[0].sendtoaddress(addr, 7) |