multi: add new config option BudgetConfig and NoDeadlineConfTarget

This commit adds a new group config `BudgetConfig` to allow users
specifying their own preference when sweeping outputs. And a new config
option `NoDeadlineConfTarget` is added in case the user wants to use a
different "lazy" conf target.
This commit is contained in:
yyforyongyu
2024-03-19 04:45:05 +08:00
parent c44b8a4b45
commit 0a611aae00
9 changed files with 298 additions and 20 deletions

View File

@@ -38,8 +38,6 @@ var (
// DefaultDeadlineDelta defines a default deadline delta (1 week) to be
// used when sweeping inputs with no deadline pressure.
//
// TODO(yy): make this configurable.
DefaultDeadlineDelta = int32(1008)
)
@@ -372,6 +370,10 @@ type UtxoSweeperConfig struct {
// Publisher is used to publish the sweep tx crafted here and monitors
// it for potential fee bumps.
Publisher Bumper
// NoDeadlineConfTarget is the conf target to use when sweeping
// non-time-sensitive outputs.
NoDeadlineConfTarget uint32
}
// Result is the struct that is pushed through the result channel. Callers can
@@ -1551,7 +1553,7 @@ func (s *UtxoSweeper) updateSweeperInputs() InputsMap {
func (s *UtxoSweeper) sweepPendingInputs(inputs InputsMap) {
// Create a default deadline height, which will be used when there's no
// DeadlineHeight specified for a given input.
defaultDeadline := s.currentHeight + DefaultDeadlineDelta
defaultDeadline := s.currentHeight + int32(s.cfg.NoDeadlineConfTarget)
// Cluster all of our inputs based on the specific Aggregator.
sets := s.cfg.Aggregator.ClusterInputs(inputs, defaultDeadline)

View File

@@ -2677,6 +2677,7 @@ func TestSweepPendingInputs(t *testing.T) {
GenSweepScript: func() ([]byte, error) {
return testPubKey.SerializeCompressed(), nil
},
NoDeadlineConfTarget: uint32(DefaultDeadlineDelta),
})
// Set a current height to test the deadline override.