lnwallet+sweep: calculate max allowed feerate on BumpResult
This commit adds the method `MaxFeeRateAllowed` to calculate the max fee rate. The caller may specify a large MaxFeeRate value, which cannot be cover by the budget. In that case, we default to use the max feerate calculated using `budget/weight`.
This commit is contained in:
3 files changed
+183
No files matched your search
@@ -58,6 +58,11 @@ func (s SatPerKVByte) String() string {
|
||||
// SatPerKWeight represents a fee rate in sat/kw.
|
||||
type SatPerKWeight btcutil.Amount
|
||||
|
||||
// NewSatPerKWeight creates a new fee rate in sat/kw.
|
||||
func NewSatPerKWeight(fee btcutil.Amount, weight uint64) SatPerKWeight {
|
||||
return SatPerKWeight(fee.MulF64(1000 / float64(weight)))
|
||||
}
|
||||
|
||||
// FeeForWeight calculates the fee resulting from this fee rate and the given
|
||||
// weight in weight units (wu).
|
||||
func (s SatPerKWeight) FeeForWeight(wu int64) btcutil.Amount {
|
||||
|
||||
Reference in new issue
Block a user