sweep+itest: change MaxFeeRate to use SatPerVbyte

This commit is contained in:
yyforyongyu 2023-07-26 11:04:04 +02:00 committed by Olaoluwa Osuntokun
parent bea0ffdf81
commit 258fe7999b
4 changed files with 12 additions and 12 deletions

View file

@ -230,10 +230,8 @@ func runCPFP(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) {
// We'll attempt to bump the fee of this transaction by performing a
// CPFP from Alice's point of view.
bumpFeeReq := &walletrpc.BumpFeeRequest{
Outpoint: op,
SatPerVbyte: uint64(
sweep.DefaultMaxFeeRate.FeePerKVByte() / 2000,
),
Outpoint: op,
SatPerVbyte: uint64(sweep.DefaultMaxFeeRate),
}
bob.RPC.BumpFee(bumpFeeReq)

View file

@ -2,6 +2,8 @@ package sweep
import (
"time"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)
var (
@ -9,4 +11,9 @@ var (
// window. The sweep is held back during the batch window to allow more
// inputs to be added and thereby lower the fee per input.
DefaultBatchWindowDuration = 30 * time.Second
// DefaultMaxFeeRate is the default maximum fee rate allowed within the
// UtxoSweeper. The current value is equivalent to a fee rate of 1,000
// sat/vbyte.
DefaultMaxFeeRate chainfee.SatPerVByte = 1e3
)

View file

@ -21,11 +21,6 @@ import (
)
const (
// DefaultMaxFeeRate is the default maximum fee rate allowed within the
// UtxoSweeper. The current value is equivalent to a fee rate of 1,000
// sat/vbyte.
DefaultMaxFeeRate = chainfee.AbsoluteFeePerKwFloor * 1e3
// DefaultFeeRateBucketSize is the default size of fee rate buckets
// we'll use when clustering inputs into buckets with similar fee rates
// within the UtxoSweeper.
@ -288,7 +283,7 @@ type UtxoSweeperConfig struct {
// MaxFeeRate is the the maximum fee rate allowed within the
// UtxoSweeper.
MaxFeeRate chainfee.SatPerKWeight
MaxFeeRate chainfee.SatPerVByte
// FeeRateBucketSize is the default size of fee rate buckets we'll use
// when clustering inputs into buckets with similar fee rates within the
@ -483,7 +478,7 @@ func (s *UtxoSweeper) feeRateForPreference(
return 0, fmt.Errorf("fee preference resulted in invalid fee "+
"rate %v, minimum is %v", feeRate, s.relayFeeRate)
}
if feeRate > s.cfg.MaxFeeRate {
if feeRate > s.cfg.MaxFeeRate.FeePerKWeight() {
return 0, fmt.Errorf("fee preference resulted in invalid fee "+
"rate %v, maximum is %v", feeRate, s.cfg.MaxFeeRate)
}

View file

@ -1186,7 +1186,7 @@ func TestBumpFeeRBF(t *testing.T) {
// We'll then attempt to bump its fee rate.
highFeePref := FeePreference{ConfTarget: 6}
highFeeRate := DefaultMaxFeeRate
highFeeRate := DefaultMaxFeeRate.FeePerKWeight()
ctx.estimator.blocksToFee[highFeePref.ConfTarget] = highFeeRate
// We should expect to see an error if a fee preference isn't provided.