Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sweep: add wallet inputs to reach dust limit #3814

Merged
merged 9 commits into from
Dec 18, 2019
8 changes: 3 additions & 5 deletions sweep/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sweep
import (
"errors"
"fmt"
"math"
"math/rand"
"sort"
"sync"
Expand Down Expand Up @@ -246,8 +245,8 @@ type UtxoSweeperConfig struct {
// of 10 would result in the following fee rate buckets up to the
// maximum fee rate:
//
// #1: min = 1 sat/vbyte, max = 10 sat/vbyte
// #2: min = 11 sat/vbyte, max = 20 sat/vbyte...
// #1: min = 1 sat/vbyte, max (exclusive) = 11 sat/vbyte
// #2: min = 11 sat/vbyte, max (exclusive) = 21 sat/vbyte...
FeeRateBucketSize int
}

Expand Down Expand Up @@ -640,8 +639,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
func (s *UtxoSweeper) bucketForFeeRate(
feeRate chainfee.SatPerKWeight) int {

minBucket := s.relayFeeRate + chainfee.SatPerKWeight(s.cfg.FeeRateBucketSize)
wpaulino marked this conversation as resolved.
Show resolved Hide resolved
return int(math.Ceil(float64(feeRate) / float64(minBucket)))
return int(feeRate-s.relayFeeRate) / s.cfg.FeeRateBucketSize
}

// clusterBySweepFeeRate takes the set of pending inputs within the UtxoSweeper
Expand Down