Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_psbt.py
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Combine, finalize, and send the psbts | # Combine, finalize, and send the psbts | ||||
combined = self.nodes[0].combinepsbt([psbt1, psbt2]) | combined = self.nodes[0].combinepsbt([psbt1, psbt2]) | ||||
finalized = self.nodes[0].finalizepsbt(combined)['hex'] | finalized = self.nodes[0].finalizepsbt(combined)['hex'] | ||||
self.nodes[0].sendrawtransaction(finalized) | self.nodes[0].sendrawtransaction(finalized) | ||||
self.nodes[0].generate(6) | self.nodes[0].generate(6) | ||||
self.sync_all() | self.sync_all() | ||||
unspent = self.nodes[0].listunspent()[0] | |||||
# Regression test for 14473 (mishandling of already-signed | |||||
# transaction): | |||||
psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid": unspent["txid"], "vout":unspent["vout"]}], [ | |||||
{self.nodes[2].getnewaddress():unspent["amount"] + 1}]) | |||||
complete_psbt = self.nodes[0].walletprocesspsbt(psbtx_info["psbt"]) | |||||
double_processed_psbt = self.nodes[0].walletprocesspsbt( | |||||
complete_psbt["psbt"]) | |||||
assert_equal(complete_psbt, double_processed_psbt) | |||||
# We don't care about the decode result, but decoding must succeed. | |||||
self.nodes[0].decodepsbt(double_processed_psbt["psbt"]) | |||||
# BIP 174 Test Vectors | # BIP 174 Test Vectors | ||||
# Check that unknown values are just passed through | # Check that unknown values are just passed through | ||||
unknown_psbt = "cHNidP8BAD8CAAAAAf//////////////////////////////////////////AAAAAAD/////AQAAAAAAAAAAA2oBAAAAAAAACg8BAgMEBQYHCAkPAQIDBAUGBwgJCgsMDQ4PAAA=" | unknown_psbt = "cHNidP8BAD8CAAAAAf//////////////////////////////////////////AAAAAAD/////AQAAAAAAAAAAA2oBAAAAAAAACg8BAgMEBQYHCAkPAQIDBAUGBwgJCgsMDQ4PAAA=" | ||||
unknown_out = self.nodes[0].walletprocesspsbt(unknown_psbt)['psbt'] | unknown_out = self.nodes[0].walletprocesspsbt(unknown_psbt)['psbt'] | ||||
assert_equal(unknown_psbt, unknown_out) | assert_equal(unknown_psbt, unknown_out) | ||||
# Open the data file | # Open the data file | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |