Repository navigation
Fix BTC/kB conversion logic - #483
Merged
Merged
Conversation
We divided by 1000 _before_ converting to a fee rate which means for sats less than 100 the value gets truncated to zero - woops. Convert to fee rate first then div by 100 afterwards. Props to 0xB10C for finding the bug.
Add a test to check that we can convert 0.000001 BTC/kB to sats i.e., 100 sats per kB (note naive div / 1000 truncates to zero).
0xB10C
added a commit
to peer-observer/peer-observer
that referenced
this pull request
Feb 6, 2026
This includes the bug fix rust-bitcoin/corepc#483 required for the following commit.
0xB10C
added a commit
to peer-observer/peer-observer
that referenced
this pull request
Feb 6, 2026
This includes the bug fix rust-bitcoin/corepc#483 required for the following commit.
0xB10C
added a commit
to peer-observer/peer-observer
that referenced
this pull request
Feb 6, 2026
This includes the bug fix rust-bitcoin/corepc#483 required for the following commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Old RPC calls use BTC/kB, we need a
FeeRatebutv0.32cannot elegantly handle the conversion so we do it manually - and surprise surprise its buggy.This bug is why we spent so much time on the
FeeRateAPI inrust-bitcoin.The original code was written by me, was untested, and was buggy (even after I worked on the API in
rust-bitcoin) - bad Tobin no biscuit.Patch 2 adds a unit test and can be put before patch 1 to see the bug.
Fix: #482