bdk
bdk copied to clipboard
Implement conversion for Lightning fee rate
This PR fixes #608.
Description
Lightning denotes transaction fee rate sats / 1000 weight units and sats / 1000 vbytes. Here we add support for creating BDK FeeRate from lightning fee rate. We also move all FeeRate tests to types.rs and rename as_sat_vb to as_sat_per_vb.
Notes to the reviewers
Matt was concerned that we might round down value in fee calculation in such a way that a transaction may not be relayed because it is below Bitcoin Core's min relay fee (1 sat/vbyte). I don't think we need to worry about that because we round up(ceil) during fee calculation, we don't round down. I will love to hear what you think. Is there something I'm missing? @johncantrell97, I will appreciate your review on this one.
Checklists
All Submissions:
- [x] I've signed all my commits
- [x] I followed the contribution guidelines
- [x] I ran
cargo fmtandcargo clippybefore committing
New Features:
- [x] I've added tests for the new feature
- [x] I've added docs for the new feature
- [x] I've updated
CHANGELOG.md
Bugfixes:
- [ ] This pull request breaks the existing API
- [ ] I've added tests to reproduce the issue which are now passing
- [x] I'm linking the issue being fixed by this PR