sweep: make sure the full input is accounted
Fix the case where previously only the witness data is taken into account when calculating the fees.
This commit is contained in:
2 files changed
+42
-17
No files matched your search
@@ -43,8 +43,11 @@ func TestBudgetAggregatorFilterInputs(t *testing.T) {
|
||||
defer wt.AssertExpectations(t)
|
||||
|
||||
// Mock the `SizeUpperBound` method to return the size four times.
|
||||
const wtSize lntypes.WeightUnit = 100
|
||||
wt.On("SizeUpperBound").Return(wtSize, true, nil).Times(4)
|
||||
const wu lntypes.WeightUnit = 100
|
||||
wt.On("SizeUpperBound").Return(wu, true, nil).Times(4)
|
||||
|
||||
// Calculate the input size.
|
||||
inpSize := lntypes.VByte(input.InputSize).ToWU() + wu
|
||||
|
||||
// Create a mock input that will be filtered out due to error.
|
||||
inpErr := &input.MockInput{}
|
||||
@@ -64,9 +67,9 @@ func TestBudgetAggregatorFilterInputs(t *testing.T) {
|
||||
var (
|
||||
// Define three budget values, one below the min fee rate, one
|
||||
// above and one equal to it.
|
||||
budgetLow = minFeeRate.FeeForWeight(wtSize) - 1
|
||||
budgetEqual = minFeeRate.FeeForWeight(wtSize)
|
||||
budgetHigh = minFeeRate.FeeForWeight(wtSize) + 1
|
||||
budgetLow = minFeeRate.FeeForWeight(inpSize) - 1
|
||||
budgetEqual = minFeeRate.FeeForWeight(inpSize)
|
||||
budgetHigh = minFeeRate.FeeForWeight(inpSize) + 1
|
||||
|
||||
// Define three outpoints with different budget values.
|
||||
opLow = wire.OutPoint{Hash: chainhash.Hash{2}}
|
||||
@@ -398,8 +401,12 @@ func TestBudgetInputSetClusterInputs(t *testing.T) {
|
||||
|
||||
// Mock the `SizeUpperBound` method to return the size 10 times since
|
||||
// we are using ten inputs.
|
||||
const wtSize lntypes.WeightUnit = 100
|
||||
wt.On("SizeUpperBound").Return(wtSize, true, nil).Times(10)
|
||||
const wu lntypes.WeightUnit = 100
|
||||
wt.On("SizeUpperBound").Return(wu, true, nil).Times(10)
|
||||
|
||||
// Calculate the input size.
|
||||
inpSize := lntypes.VByte(input.InputSize).ToWU() + wu
|
||||
|
||||
wt.On("String").Return("mock witness type")
|
||||
|
||||
// Mock the estimator to return a constant fee rate.
|
||||
@@ -409,8 +416,8 @@ func TestBudgetInputSetClusterInputs(t *testing.T) {
|
||||
var (
|
||||
// Define two budget values, one below the min fee rate and one
|
||||
// above it.
|
||||
budgetLow = minFeeRate.FeeForWeight(wtSize) - 1
|
||||
budgetHigh = minFeeRate.FeeForWeight(wtSize) + 1
|
||||
budgetLow = minFeeRate.FeeForWeight(inpSize) - 1
|
||||
budgetHigh = minFeeRate.FeeForWeight(inpSize) + 1
|
||||
|
||||
// Create three deadline heights, which means there are three
|
||||
// groups of inputs to be expected.
|
||||
|
||||
Reference in new issue
Block a user