multi: make sure CPFP won't exceed max allowed fee rate

This commit updates the `fee()` method in `weightEstimator` to make sure
when doing CPFP we are not exceeding the max allowed fee rate. In order
to use the max fee rate, we need to modify several methods to pass the
configured value to the estimator.
This commit is contained in:
yyforyongyu authored and Olaoluwa Osuntokun committed 2023-10-06 16:34:47 -07:00
1 parent 42ff52bbfb
commit 24fa35ec80
12 files changed
+132 -48

No files matched your search

+3 -3
View File
@@ -16,7 +16,7 @@ func TestTxInputSet(t *testing.T) {
feeRate = 1000
maxInputs = 10
)
set := newTxInputSet(nil, feeRate, maxInputs)
set := newTxInputSet(nil, feeRate, 0, maxInputs)
// Create a 300 sat input. The fee to sweep this input to a P2WKH output
// is 439 sats. That means that this input yields -139 sats and we
@@ -65,7 +65,7 @@ func TestTxInputSetFromWallet(t *testing.T) {
)
wallet := &mockWallet{}
set := newTxInputSet(wallet, feeRate, maxInputs)
set := newTxInputSet(wallet, feeRate, 0, maxInputs)
// Add a 500 sat input to the set. It yields positively, but doesn't
// reach the output dust limit.
@@ -134,7 +134,7 @@ func TestTxInputSetRequiredOutput(t *testing.T) {
feeRate = 1000
maxInputs = 10
)
set := newTxInputSet(nil, feeRate, maxInputs)
set := newTxInputSet(nil, feeRate, 0, maxInputs)
// Attempt to add an input with a required txout below the dust limit.
// This should fail since we cannot trim such outputs.