Remove BIP 174's claim that Combine is commutative
The BIP asserts that `fA(fB(psbt)) == fB(fA(psbt))`, however the explanatory text before this doesn't actually say this and even hints that the ordering does matter: "processing [..] A and then B *in a sequence*". It seems that the BIP text only supports the `Combine(fA(psbt), fB(psbt)) == fB(fA(psbt))` part, and that `fA(fB(psbt))` slipped in by accident? In practice, Bitcoin Core's `combinepsbt` isn't commutative and gives precedence to latter PSBTs in the array. Here's a quick example demons
No reviewsSpecification
The BIP asserts that fA(fB(psbt)) == fB(fA(psbt)), however the explanatory text before this doesn't actually say this and even hints that the ordering does matter: "processing [..] A and then B in a sequence". It seems that the BIP text only supports the Combine(fA(psbt), fB(psbt)) == fB(fA(psbt)) part, and that fA(fB(psbt)) slipped in by accident?
In practice, Bitcoin Core's combinepsbt isn't commutative and gives precedence to latter PSBTs in the array. Here's a quick example demonstrating this:
PSBT_A="cHNidP8BADMCAAAAAa83fnb+Vw0gR7jZBeABQNh2dFx8F+MbmvHAM8N5+O07AAAAAAD/////AAAAAAAAAQUBUQA="
PSBT_B="cHNidP8BADMCAAAAAa83fnb+Vw0gR7jZBeABQNh2dFx8F+MbmvHAM8N5+O07AAAAAAD/////AAAAAAAAAQUBUgA="
$ bitcoin-cli decodepsbt $(bitcoin-cli combinepsbt [\"$PSBT_A\",\"$PSBT_B\"]) | jq -r .inputs[0].witness_script.asm
1
$ bitcoin-cli decodepsbt $(bitcoin-cli combinepsbt [\"$PSBT_B\",\"$PSBT_A\"]) | jq -r .inputs[0].witness_script.asm
2
And here's a related discussion about rust-bitcoin's Psbt::combine(), which isn't commutative either but documented as "In accordance with BIP 174 this function is commutative": https://github.com/rust-bitcoin/rust-bitcoin/issues/5486
Discussion (0 threads)
Sign in to start a discussion on this spec.