chainfee: method to round up the fee for a given transaction weight

This commit is contained in:
Slyghtning committed 2025-06-25 10:02:04 +02:00
1 parent 4335d9cfb7
commit ab8ae542d0
2 files changed
+19

No files matched your search

+8
View File
@@ -71,6 +71,14 @@ func (s SatPerKWeight) FeeForWeight(wu lntypes.WeightUnit) btcutil.Amount {
return btcutil.Amount(s) * btcutil.Amount(wu) / 1000
}
// FeeForWeightRoundUp calculates the fee resulting from this fee rate and the
// given weight in weight units (wu), rounding up to the nearest satoshi.
func (s SatPerKWeight) FeeForWeightRoundUp(
wu lntypes.WeightUnit) btcutil.Amount {
return (btcutil.Amount(s)*btcutil.Amount(wu) + 999) / 1000
}
// FeeForVByte calculates the fee resulting from this fee rate and the given
// size in vbytes (vb).
func (s SatPerKWeight) FeeForVByte(vb lntypes.VByte) btcutil.Amount {