sweep: fix bucket clustering
Fixes a bug where bucket sizes were not the configured size, but the configured size plus the min relay fee.
This commit is contained in:
parent
50078216ca
commit
e2bf6b49e9
@ -3,7 +3,6 @@ package sweep
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
@ -246,8 +245,8 @@ type UtxoSweeperConfig struct {
|
|||||||
// of 10 would result in the following fee rate buckets up to the
|
// of 10 would result in the following fee rate buckets up to the
|
||||||
// maximum fee rate:
|
// maximum fee rate:
|
||||||
//
|
//
|
||||||
// #1: min = 1 sat/vbyte, max = 10 sat/vbyte
|
// #1: min = 1 sat/vbyte, max (exclusive) = 11 sat/vbyte
|
||||||
// #2: min = 11 sat/vbyte, max = 20 sat/vbyte...
|
// #2: min = 11 sat/vbyte, max (exclusive) = 21 sat/vbyte...
|
||||||
FeeRateBucketSize int
|
FeeRateBucketSize int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,8 +639,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
|
|||||||
func (s *UtxoSweeper) bucketForFeeRate(
|
func (s *UtxoSweeper) bucketForFeeRate(
|
||||||
feeRate chainfee.SatPerKWeight) int {
|
feeRate chainfee.SatPerKWeight) int {
|
||||||
|
|
||||||
minBucket := s.relayFeeRate + chainfee.SatPerKWeight(s.cfg.FeeRateBucketSize)
|
return int(feeRate-s.relayFeeRate) / s.cfg.FeeRateBucketSize
|
||||||
return int(math.Ceil(float64(feeRate) / float64(minBucket)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clusterBySweepFeeRate takes the set of pending inputs within the UtxoSweeper
|
// clusterBySweepFeeRate takes the set of pending inputs within the UtxoSweeper
|
||||||
|
Loading…
Reference in New Issue
Block a user