Repository navigation
Request v0 PSBTs from Bitcoin Core 32 - #2058
AdityaKaushal17 wants to merge 1 commit into
Conversation
Bitcoin Core 32 returns a version 2 PSBT from walletcreatefundedpsbt by default. rust-bitcoin 0.32 only parses version 0, so payjoin-cli send failed against such a node. Ask getnetworkinfo for the node version once and reuse the answer. For Core 32 and later, call walletcreatefundedpsbt through call_raw with psbt_version=0, since bitcoind-async-client has no way to pass that argument. Earlier versions keep the existing typed call. The version check and the raw arguments are built by small functions so that unit tests cover them without a Core 32 node. The locktime is now a plain u32 because both branches need the value. Receiving on Core 32 still fails where gettransaction is parsed, because the node no longer returns bip125-replaceable. That is left for a separate change. Fixes payjoin#2054
caarloshenriq
left a comment
There was a problem hiding this comment.
ACK d735229
I don't have a Core 32 node, so I haven't run the new path. I checked that bitcoind-async-client 0.16.1 sends only five positional args to walletcreatefundedpsbt, so call_raw is needed, and that the raw params match what the typed call sends (locktime, and options serialized the same way, so fee_rate stays in sat/vB). The unit tests pass and clippy is clean.
Since CI runs an older bitcoind, the Core 32 branch is only covered by your manual e2e run. Is bumping the test node to 32 tracked anywhere? That would also catch the other walletcreatefundedpsbt callers you mentioned.
Thanks for reviewing! Not tracked as far as I can see. Bumping the test node to 32 would also hit the gettransaction/bip125-replaceable problem I mentioned, so the 4 v2 e2e tests would fail until that’s fixed. I’ll open an issue for that and include a CI test node bump to Core 32 as part of it, so the other walletcreatefundedpsbt callers get covered too. |
Coverage Report for CI Build 43924149511Coverage remained the same at 87.657%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Fixes #2054
Reviewer: @spacebear21
On Core 32,
walletcreatefundedpsbtreturns a v2 PSBT by default. rust-bitcoin 0.32 can only parse v0, sopayjoin-cli sendfails withconversion of the psbt field failedbefore it even reaches the receiver. On Core 31.1 it works fine.As discussed in #2054, this PR asks Core for a v0 PSBT when the node is 32 or newer, and leaves the call as it is for 31 and older.
What I changed
getnetworkinfothe first timecreate_psbtruns, and cache it, so commands that don't send never need it.walletcreatefundedpsbtthroughcall_rawand passpsbt_version=0as the 7th argument. The typed client has no way to pass this argument, so I added a TODO to switch back once it does.walletprocesspsbtkeeps whatever version it gets, so nothing after this needs changing.optionsgoes through the sameserde_json::to_valueas the typed call, sofee_rateis still sent in sat/vB. I added a unit test for this (375 sat/kwu -> 1.5).locktimeis now a plainu32, since both branches use it.Testing
./contrib/test_local.sh./contrib/lint.sh, fmt, clippy, docs, codespelle2e::send_receive_payjoin_v1ande2e::send_receive_payjoin_v2_to_v1passI couldn't run
nix fmt -- --cibecause I don't have nix installed.Things to note
>= 320000, but I haven't tried 32.0 myself.walletcreatefundedpsbt(payjoin integration tests and the FFI tests) don't passpsbt_version, so they'll probably break on Core 32 too. I left those out to keep this PR small.gettransactionno longer returnsbip125-replaceable, and bitcoind-async-client 0.16.1 expects it. That breaks 4 v2 e2e tests on 32.1. I'll open a separate issue for it, which is why I didn't touch the supported versions in the README.AI disclosure: I used Claude Code to help write the code and this description, and ran a local AI review before opening. I went through the diff and ran the tests myself.
Pull Request Checklist
Please confirm the following before requesting review: