Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_psbt.py
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
joined_decoded['outputs']) == 2 and "final_scriptSig" not in joined_decoded['inputs'][3] | joined_decoded['outputs']) == 2 and "final_scriptSig" not in joined_decoded['inputs'][3] | ||||
# Fail when trying to join less than two PSBTs | # Fail when trying to join less than two PSBTs | ||||
assert_raises_rpc_error(-8, | assert_raises_rpc_error(-8, | ||||
"At least two PSBTs are required to join PSBTs.", self.nodes[1].joinpsbts, []) | "At least two PSBTs are required to join PSBTs.", self.nodes[1].joinpsbts, []) | ||||
assert_raises_rpc_error(-8, | assert_raises_rpc_error(-8, | ||||
"At least two PSBTs are required to join PSBTs.", self.nodes[1].joinpsbts, [psbt2]) | "At least two PSBTs are required to join PSBTs.", self.nodes[1].joinpsbts, [psbt2]) | ||||
# 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 | # Newly created PSBT needs UTXOs and updating | ||||
addr = self.nodes[1].getnewaddress("") | addr = self.nodes[1].getnewaddress("") | ||||
txid = self.nodes[0].sendtoaddress(addr, 7) | txid = self.nodes[0].sendtoaddress(addr, 7) | ||||
blockhash = self.nodes[0].generate(6)[0] | blockhash = self.nodes[0].generate(6)[0] | ||||
self.sync_all() | self.sync_all() | ||||
vout = find_output(self.nodes[0], txid, 7, blockhash=blockhash) | vout = find_output(self.nodes[0], txid, 7, blockhash=blockhash) | ||||
psbt = self.nodes[1].createpsbt([{"txid": txid, "vout": vout}], { | psbt = self.nodes[1].createpsbt([{"txid": txid, "vout": vout}], { | ||||
self.nodes[0].getnewaddress(""): Decimal('6.999')}) | self.nodes[0].getnewaddress(""): Decimal('6.999')}) | ||||
Show All 23 Lines |