fix(bitcoin): round send fee_rate to 3 decimals#3729
Draft
TaprootFreak wants to merge 1 commit into
Draft
Conversation
Bitcoin Core's send/sendmany RPC parses fee_rate with decimals=3 via ParseFixedPoint and rejects values with more precision via "Invalid amount" (error code -3). JS floating-point can produce values like 1.935 * 2 = 3.8699999999999997, which silently stalls the BTC payout pipeline. Round the computed sat/vB fee rate to 3 decimals at the source so every Bitcoin send RPC receives a value Bitcoin Core can parse.
davidleomay
approved these changes
May 20, 2026
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.
Summary
The BTC payout pipeline silently stalled today (2026-05-20) for ~80 minutes — every
sendmany/sendRPC was rejected by Bitcoin Core withInvalid amount(error code-3). A 120k EUR buy-crypto (and several smaller ones) sat inCreateduntil the stuck batch was manually cleared.Root cause
Bitcoin Core's
send/sendmanyRPC parses thefee_rateargument with decimals=3 (source):ParseFixedPointreturnsfalsewhen the parsed value has more than 3 decimal places, whichAmountFromValuere-throws as"Invalid amount".Our fee-rate computation chain produces values with floating-point artifacts:
Reproduced against the live BTC output node:
This also explains:
rpc.sendwith a sat/vBfee_rate).estimatesmartfeehappened to return a value that survived the multiplication without artifacts.Fix
Round the computed
sat/vBfee rate to 3 decimal places inBitcoinBasedFeeService.getSendFeeRate(), which is the single source consumed byPayoutBitcoinService.sendUtxoToManyand the dex Bitcoin strategies.Test plan
bitcoin-fee.service.spec.tscovering the exact floating-point case (1.935 * 2 -> 3.87, not3.8699999999999997).npm run lint,npm run format:check,npm run build, full Bitcoin fee test suite: all green locally.