Skip to content

fix: format BTC amounts exactly via integer sat-to-decimal#444

Open
nullcount wants to merge 1 commit into
ElementsProject:masterfrom
nullcount:fix/elements/decimal-precision
Open

fix: format BTC amounts exactly via integer sat-to-decimal#444
nullcount wants to merge 1 commit into
ElementsProject:masterfrom
nullcount:fix/elements/decimal-precision

Conversation

@nullcount
Copy link
Copy Markdown

fixes: #442

Replace fmt.Sprintf("%f", float64(sats)/1e8), which truncates to 6
decimals and round-trips through float64, with a pure integer
SatsToBTCString helper that emits "%d.%08d". Applied at every BTC
amount string formatted for the Elements RPC: SendToAddress, the
FundRawWithOptions feeRate (rounded to nearest sat/kB first), and
the test Faucet helpers (now taking uint64 sats instead of float
BTC).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Rounding error in satsToAmountString() elementsrpcwallet.go

1 participant