Skip to content

Commit 1f1a274

Browse files
committed
sweepbatcher: fix copy-paste with batchConfig
1 parent 1290ebe commit 1f1a274

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

sweepbatcher/sweep_batcher.go

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,7 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
506506

507507
// spinUpBatch spins up a new batch and returns it.
508508
func (b *Batcher) spinUpBatch(ctx context.Context) (*batch, error) {
509-
cfg := batchConfig{
510-
maxTimeoutDistance: defaultMaxTimeoutDistance,
511-
noBumping: b.noBumping,
512-
customMuSig2Signer: b.customMuSig2Signer,
513-
}
509+
cfg := b.newBatchConfig(defaultMaxTimeoutDistance)
514510

515511
switch b.chainParams {
516512
case &chaincfg.MainNetParams:
@@ -625,11 +621,7 @@ func (b *Batcher) spinUpBatchFromDB(ctx context.Context, batch *batch) error {
625621
quit: b.quit,
626622
}
627623

628-
cfg := batchConfig{
629-
maxTimeoutDistance: batch.cfg.maxTimeoutDistance,
630-
noBumping: b.noBumping,
631-
customMuSig2Signer: b.customMuSig2Signer,
632-
}
624+
cfg := b.newBatchConfig(batch.cfg.maxTimeoutDistance)
633625

634626
newBatch, err := NewBatchFromDB(cfg, batchKit)
635627
if err != nil {
@@ -689,11 +681,7 @@ func (b *Batcher) FetchUnconfirmedBatches(ctx context.Context) ([]*batch,
689681
}
690682
batch.rbfCache = rbfCache
691683

692-
bchCfg := batchConfig{
693-
maxTimeoutDistance: bch.MaxTimeoutDistance,
694-
noBumping: b.noBumping,
695-
customMuSig2Signer: b.customMuSig2Signer,
696-
}
684+
bchCfg := b.newBatchConfig(bch.MaxTimeoutDistance)
697685
batch.cfg = &bchCfg
698686

699687
batches = append(batches, &batch)
@@ -909,3 +897,12 @@ func (b *Batcher) loadSweep(ctx context.Context, swapHash lntypes.Hash,
909897
minFeeRate: s.MinFeeRate,
910898
}, nil
911899
}
900+
901+
// newBatchConfig creates new batch config.
902+
func (b *Batcher) newBatchConfig(maxTimeoutDistance int32) batchConfig {
903+
return batchConfig{
904+
maxTimeoutDistance: maxTimeoutDistance,
905+
noBumping: b.noBumping,
906+
customMuSig2Signer: b.customMuSig2Signer,
907+
}
908+
}

0 commit comments

Comments
 (0)