Skip to content

fix: convert fee estimates from BTC/kB to sat/vB#8

Merged
douglaz merged 1 commit intomasterfrom
fix/fee-estimates-sat-vb
Jan 14, 2026
Merged

fix: convert fee estimates from BTC/kB to sat/vB#8
douglaz merged 1 commit intomasterfrom
fix/fee-estimates-sat-vb

Conversation

@douglaz
Copy link
Copy Markdown
Collaborator

@douglaz douglaz commented Jan 14, 2026

Summary

  • Fix fee estimate endpoint returning values in BTC/kB instead of sat/vB (esplora format)
  • Bitcoin Core's estimatesmartfee returns BTC/kB, converted using to_sat() / 1000
  • Fix default fallback from 0.0001 BTC/kB to 1.0 sat/vB

Before (broken)

{"1": 0.00001198, "2": 0.00001198, ...}

After (correct)

{"1": 1.198, "2": 1.198, ...}

Test plan

  • Unit test for fee rate conversion formula
  • Bash tests verify fee values are in sat/vB range (0.5-10000)
  • Bash test compares with blockstream to verify similar values
  • All existing tests pass

@douglaz douglaz force-pushed the fix/fee-estimates-sat-vb branch from e3e5cc6 to 47b98d7 Compare January 14, 2026 18:47
Bitcoin Core's estimatesmartfee returns BTC/kB, but esplora API
expects sat/vB. Fixed by using to_sat() and dividing by 1000.

Also fixed the default fallback from 0.0001 BTC/kB to 1.0 sat/vB.

Added:
- Unit test for fee rate conversion formula
- Bash tests to verify fee values are in sat/vB range
- Bash test to compare fee estimates with blockstream
@douglaz douglaz force-pushed the fix/fee-estimates-sat-vb branch from 47b98d7 to 7ae3341 Compare January 14, 2026 18:52
@douglaz douglaz merged commit 95d8f34 into master Jan 14, 2026
4 checks passed
@douglaz douglaz deleted the fix/fee-estimates-sat-vb branch January 14, 2026 18:56
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.

1 participant