Skip to content

Conversation

@jamillambert
Copy link
Collaborator

testmempoolaccept is untested and missing return fields added in versions after v17.

The helper function btc_per_kb returned a TooPreciseError with 1e-5 btc_per_kb which should work. Due to the imprecise representation of 1e-5 in binary in f64, and when divided by 1000 and converting to sats results in 0.9999999999999998 not 1.0. Rounding is not possible since it will remove all occurances of TooPreciseError.

  • Update btc_per_kb to do the division by 1000 after creating the Amount in sats.
  • Add a test for testmempoolaccept and redefine the struct, model and into_model functions for changes in the RPC for all versions up to 29.
  • Run the formatter

The function gives a `TooPreciceError` if 1e-5 is passed to it, i.e. 1
Sat / vb, due to the imprecise calculation in base2 f64.

Move the division to after the conversion to Sats to remove the rounding
error.
Add a test for `testmempoolaccept` and implement all the changes to the 
returned fields in versions 21, 22, 25 and 29.

Update the types table
Reordering of reexports only
Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 7401356

@tcharding tcharding merged commit c27c7a6 into rust-bitcoin:master Aug 13, 2025
30 checks passed
spacebear21 added a commit to spacebear21/rust-payjoin that referenced this pull request Sep 5, 2025
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 added a commit to spacebear21/rust-payjoin that referenced this pull request Sep 5, 2025
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.
blaze-smith470pm added a commit to blaze-smith470pm/corepc that referenced this pull request Sep 26, 2025
…e structs

74013560445acc0efd3281969f1e587f0b100ec8 Run the formatter (jamillambert)
5f9d6f598ede852f3a427735fe117aa45069ad41 Add testmempoolaccept test and update structs (jamillambert)
60dbb35130110cad56d170d3497c4db47a1913f2 Fix rounding error in btc_per_kb (Jamil Lambert, PhD)

Pull request description:

  `testmempoolaccept` is untested and missing return fields added in versions after v17.

  The helper function `btc_per_kb` returned a `TooPreciseError` with 1e-5 `btc_per_kb` which should work. Due to the imprecise representation of 1e-5 in binary in f64, and when divided by 1000 and converting to sats results in 0.9999999999999998 not 1.0. Rounding is not possible since it will remove all occurances of `TooPreciseError`.

  - Update `btc_per_kb` to do the division by 1000 after creating the `Amount` in sats.
  - Add a test for `testmempoolaccept` and redefine the struct, model and into_model functions for changes in the RPC for all versions up to 29.
  - Run the formatter

ACKs for top commit:
  tcharding:
    ACK 74013560445acc0efd3281969f1e587f0b100ec8

Tree-SHA512: 8d8c26bab040458e786620843e1305e19d79c612c930fd20afd307a68b750598d5142d44d696b46afd6ba94e6b877962a22faf393bf81a8a630d6cf62eaa4e5b
node-smithxby72w added a commit to node-smithxby72w/rust-payjoin that referenced this pull request Sep 28, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants