From 88384180d3e7a20155eed65290a23b2e603683db Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Tue, 17 Mar 2026 15:36:09 -0700 Subject: [PATCH] test: PSBTs should roundtrip through RPCs that do nothing --- test/functional/rpc_psbt.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index e85a3372187..cd47f61ada6 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -426,6 +426,21 @@ class PSBTTest(BitcoinTestFramework): self.log.info("PSBT parameter handling test completed successfully") + def test_psbt_roundtrip(self): + self.log.info("Test that PSBTs roundtrip when RPC does nothing") + utxo = self.nodes[0].listunspent()[0] + psbt = self.nodes[0].walletcreatefundedpsbt(inputs=[utxo], outputs=[{self.nodes[0].getnewaddress(): utxo["amount"] / 2}])["psbt"] + + rt_psbts = [ + self.nodes[0].combinepsbt([psbt, psbt]), + self.nodes[0].finalizepsbt(psbt)["psbt"], + self.nodes[0].utxoupdatepsbt(psbt), + self.nodes[0].descriptorprocesspsbt(psbt, [])["psbt"], + self.nodes[0].walletprocesspsbt(psbt, sign=False)["psbt"], + ] + for p in rt_psbts: + assert_equal(psbt, p) + def run_test(self): # Create and fund a raw tx for sending 10 BTC psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt'] @@ -1294,6 +1309,7 @@ class PSBTTest(BitcoinTestFramework): self.test_sighash_mismatch() self.test_sighash_adding() self.test_psbt_named_parameter_handling() + self.test_psbt_roundtrip() if __name__ == '__main__': PSBTTest(__file__).main()