Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_psbt.py
Show All 17 Lines | |||||
# Create one-input, one-output, no-fee transaction: | # Create one-input, one-output, no-fee transaction: | ||||
class PSBTTest(BitcoinTestFramework): | class PSBTTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
self.num_nodes = 3 | self.num_nodes = 3 | ||||
# TODO: remove -txindex. Currently required for getrawtransaction call. | |||||
self.extra_args = [["-txindex"], ["-txindex"], ["-txindex"]] | |||||
deadalnix: It doesn't look like there is any call to `getrawtransaction` as you pointed out, this doesn't… | |||||
def skip_test_if_missing_module(self): | def skip_test_if_missing_module(self): | ||||
self.skip_if_no_wallet() | self.skip_if_no_wallet() | ||||
def run_test(self): | def run_test(self): | ||||
# Create and fund a raw tx for sending 10 BTC | # Create and fund a raw tx for sending 10 BTC | ||||
psbtx1 = self.nodes[0].walletcreatefundedpsbt( | psbtx1 = self.nodes[0].walletcreatefundedpsbt( | ||||
[], {self.nodes[2].getnewaddress(): 10})['psbt'] | [], {self.nodes[2].getnewaddress(): 10})['psbt'] | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
";definitely not base64;") | ";definitely not base64;") | ||||
# Test that psbts with p2pkh outputs are created properly | # Test that psbts with p2pkh outputs are created properly | ||||
p2pkh = self.nodes[0].getnewaddress() | p2pkh = self.nodes[0].getnewaddress() | ||||
psbt = self.nodes[1].walletcreatefundedpsbt( | psbt = self.nodes[1].walletcreatefundedpsbt( | ||||
[], [{p2pkh: 1}], 0, {"includeWatching": True}, True) | [], [{p2pkh: 1}], 0, {"includeWatching": True}, True) | ||||
self.nodes[0].decodepsbt(psbt['psbt']) | self.nodes[0].decodepsbt(psbt['psbt']) | ||||
# Send to all types of addresses | |||||
addr1 = self.nodes[1].getnewaddress("") # originally bech32 | |||||
txid1 = self.nodes[0].sendtoaddress(addr1, 11) | |||||
vout1 = find_output(self.nodes[0], txid1, 11) | |||||
addr2 = self.nodes[1].getnewaddress("") # originally legacy | |||||
txid2 = self.nodes[0].sendtoaddress(addr2, 11) | |||||
vout2 = find_output(self.nodes[0], txid2, 11) | |||||
addr3 = self.nodes[1].getnewaddress("") # originally p2sh-segwit | |||||
txid3 = self.nodes[0].sendtoaddress(addr3, 11) | |||||
vout3 = find_output(self.nodes[0], txid3, 11) | |||||
self.sync_all() | |||||
# Update a PSBT with UTXOs from the node | |||||
psbt = self.nodes[1].createpsbt([{"txid": txid1, "vout": vout1}, {"txid": txid2, "vout": vout2}, { | |||||
"txid": txid3, "vout": vout3}], {self.nodes[0].getnewaddress(): 32.999}) | |||||
decoded = self.nodes[1].decodepsbt(psbt) | |||||
updated = self.nodes[1].utxoupdatepsbt(psbt) | |||||
decoded = self.nodes[1].decodepsbt(updated) | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
PSBTTest().main() | PSBTTest().main() |
It doesn't look like there is any call to getrawtransaction as you pointed out, this doesn't seems to be required here. So quite clearly, something is missing somewhere. Adding random flags is not the solution.