sweep+lnd: introduce UtxoAggregator to handle clustering inputs

This commit refactors the grouping logic into a new interface
`UtxoAggregator`, which makes it easier to write tests and opens
possibility for future customized clustering strategies.

The old clustering logic is kept as and moved into `SimpleAggregator`.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:21 +08:00
1 parent 3bcac318eb
commit 1870caf39c
6 files changed
+807 -728

No files matched your search

+5 -1
View File
@@ -1063,6 +1063,10 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
return nil, err
}
aggregator := sweep.NewSimpleUtxoAggregator(
cc.FeeEstimator, cfg.Sweeper.MaxFeeRate.FeePerKWeight(),
)
s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{
FeeEstimator: cc.FeeEstimator,
GenSweepScript: newSweepPkScriptGen(cc.Wallet),
@@ -1075,7 +1079,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
MaxSweepAttempts: sweep.DefaultMaxSweepAttempts,
NextAttemptDeltaFunc: sweep.DefaultNextAttemptDeltaFunc,
MaxFeeRate: cfg.Sweeper.MaxFeeRate,
FeeRateBucketSize: sweep.DefaultFeeRateBucketSize,
Aggregator: aggregator,
})
s.utxoNursery = contractcourt.NewUtxoNursery(&contractcourt.NurseryConfig{