Skip to content

Replace bitcoind with corepc_node#1041

Merged
arminsabouri merged 3 commits intopayjoin:masterfrom
spacebear21:replace-bitcoind
Sep 5, 2025
Merged

Replace bitcoind with corepc_node#1041
arminsabouri merged 3 commits intopayjoin:masterfrom
spacebear21:replace-bitcoind

Conversation

@spacebear21
Copy link
Collaborator

@spacebear21 spacebear21 commented Sep 4, 2025

The first commit addresses #369 so we can include taproot integration tests ahead of 1.0. The second commit simplifies the fee calculations in the integration tests to simply hardcode expected fees and match those against the actual PSBT fee. Finally, the third commit enables the taproot test with the proper expected fee.

I used Claude Code to troubleshoot some errors and ideate, but rawdogged the actual code changes.

Pull Request Checklist

Please confirm the following before requesting review:

@spacebear21 spacebear21 force-pushed the replace-bitcoind branch 3 times, most recently from dad6c92 to 6ae837a Compare September 5, 2025 03:04
@coveralls
Copy link
Collaborator

coveralls commented Sep 5, 2025

Pull Request Test Coverage Report for Build 17503708210

Details

  • 13 of 14 (92.86%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.007%) to 85.933%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin-test-utils/src/lib.rs 13 14 92.86%
Totals Coverage Status
Change from base Build 17498852412: -0.007%
Covered Lines: 8186
Relevant Lines: 9526

💛 - Coveralls

bitcoind is no longer maintained and is incompatible with newer versions
of Bitcoin Core. corepc-node is the "official" successor (see
deprecation notice on https://docs.rs/bitcoind/latest/bitcoind/).

However, the the latest tagged release for corepc_node as of writing
(0.8.0) contains several bugs when deserializing the
[testmempoolaccept](rust-bitcoin/corepc#327),
[walletprocesspsbt](rust-bitcoin/corepc#340),
and [finalizepsbt](rust-bitcoin/corepc#326) RPC
responses. The linked PRs fixed those issues, but haven't been included
in a release yet.

For now we can point to a specific git rev from
https://github.com/rust-bitcoin/corepc to make those fixes available.
@spacebear21 spacebear21 changed the title WIP: Replace bitcoind with corepc_node Replace bitcoind with corepc_node Sep 5, 2025
@arminsabouri arminsabouri self-requested a review September 5, 2025 19:04
Copy link
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ddc5264

My only suggestion would be to replace the hardcoded u64 expecteded fee components with weight consts. That can be a left as a follow up or done in this PR. Shouldn't be a blocker.

payjoin = { path = "payjoin" }
payjoin-directory = { path = "payjoin-directory" }
payjoin-test-utils = { path = "payjoin-test-utils" }
# TODO: Remove these patches once a new version (>0.8.0) is released to crates.io
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder to self to create an issue for a follow up

do_v1_to_v1(sender, receiver, true)
// tx_header_vbytes + inputs_vb + outputs_vb - 1 vb saved from signature grinding,
// at 1 sat/vb
let expected_fee = Amount::from_sat(10 + (148 * 2) + (31 * 2) - 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are a bit hard to read and understand. Would bitcoin::Weight consts help?
Psuedocode:

let weight = Weight::new(NON_SEGWIT_TX_HEADER + (LEGACY_INPUT_WEIGHT * 2) + (P2WPKH_OUTPUT_WEIGHT * 2) - SIG_GRIDING_WEIGHT_SAVINGS))

let expected_fee = Amount::from(to_vsize(weight) * FeeRate::from_sat_vb(1))

@spacebear21
Copy link
Collaborator Author

I had considered the const approach and decided it would be a lot of boilerplate just for tests, but it's actually not that bad and I agree it's more readable this way. Also, using Weight means the we can use integer values instead of floats for taproot inputs size.

Instead of dynamically calculating expected fees with weight
predictions, hardcode the expected values and assert that the resulting
fees match.
Now that we support later versions of bitcoin core, we can enable the
taproot test.
Copy link
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK
Thanks for making those changes

@arminsabouri arminsabouri merged commit 1970efe into payjoin:master Sep 5, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants