test: PSBTs should roundtrip through RPCs that do nothing
What changed, and why it matters
This commit only adds a new automated test to Bitcoin Core. It checks that certain PSBT (Partially Signed Bitcoin Transaction) RPC commands, when called in a way that should make no meaningful change, return the exact same PSBT they were given. There is no change to production code, no bug fix, and no security patch.
No security action needed. Treat as routine test coverage addition.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds test_psbt_roundtrip() to test/functional/rpc_psbt.py. It creates a funded PSBT and verifies that combinepsbt([psbt, psbt]), finalizepsbt, utxoupdatepsbt, descriptorprocesspsbt, and walletprocesspsbt(sign=False) each return a byte-identical PSBT. This is a regression/behavioral test, not a code change.
Changed components
test/functional/rpc_psbt.pyInspect captured patch +16 / −0
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index e85a3372..cd47f61a 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()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.