sweep: increase delta fee rate precision in fee function

This commit adds a private type `mSatPerKWeight` that expresses a given
fee rate in millisatoshi per kw. This is needed to increase the
precision of the fee function. When sweeping anchor inputs, if using a
deadline delta of over 1000, it's likely the delta will be 0 sat/kw due
to precision.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:29 +08:00
1 parent 23feef7e6c
commit 7fb18bc0d5
2 files changed
+32 -9

No files matched your search

+3 -3
View File
@@ -54,8 +54,8 @@ func TestLinearFeeFunctionNew(t *testing.T) {
//
// Mock the fee estimator to return the fee rate.
estimator.On("EstimateFeePerKW", confTarget).Return(
// The starting fee rate is 1 sat/kw less than the max fee rate.
maxFeeRate-1, nil).Once()
// The starting fee rate is the max fee rate.
maxFeeRate, nil).Once()
estimator.On("RelayFeePerKW").Return(estimatedFeeRate).Once()
f, err = NewLinearFeeFunction(maxFeeRate, confTarget, estimator)
@@ -96,7 +96,7 @@ func TestLinearFeeFunctionFeeRateAtPosition(t *testing.T) {
startingFeeRate: 1000,
endingFeeRate: 3000,
position: 0,
deltaFeeRate: 1000,
deltaFeeRate: 1_000_000,
width: 3,
}