2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-08 01:10:29 +00:00

sweepbatcher: fix copy-paste with batchConfig

This commit is contained in:
Boris Nagaev 2024-06-27 13:04:06 -03:00
parent 1290ebe535
commit 1f1a27447c
No known key found for this signature in database

View File

@ -506,11 +506,7 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
// spinUpBatch spins up a new batch and returns it.
func (b *Batcher) spinUpBatch(ctx context.Context) (*batch, error) {
cfg := batchConfig{
maxTimeoutDistance: defaultMaxTimeoutDistance,
noBumping: b.noBumping,
customMuSig2Signer: b.customMuSig2Signer,
}
cfg := b.newBatchConfig(defaultMaxTimeoutDistance)
switch b.chainParams {
case &chaincfg.MainNetParams:
@ -625,11 +621,7 @@ func (b *Batcher) spinUpBatchFromDB(ctx context.Context, batch *batch) error {
quit: b.quit,
}
cfg := batchConfig{
maxTimeoutDistance: batch.cfg.maxTimeoutDistance,
noBumping: b.noBumping,
customMuSig2Signer: b.customMuSig2Signer,
}
cfg := b.newBatchConfig(batch.cfg.maxTimeoutDistance)
newBatch, err := NewBatchFromDB(cfg, batchKit)
if err != nil {
@ -689,11 +681,7 @@ func (b *Batcher) FetchUnconfirmedBatches(ctx context.Context) ([]*batch,
}
batch.rbfCache = rbfCache
bchCfg := batchConfig{
maxTimeoutDistance: bch.MaxTimeoutDistance,
noBumping: b.noBumping,
customMuSig2Signer: b.customMuSig2Signer,
}
bchCfg := b.newBatchConfig(bch.MaxTimeoutDistance)
batch.cfg = &bchCfg
batches = append(batches, &batch)
@ -909,3 +897,12 @@ func (b *Batcher) loadSweep(ctx context.Context, swapHash lntypes.Hash,
minFeeRate: s.MinFeeRate,
}, nil
}
// newBatchConfig creates new batch config.
func (b *Batcher) newBatchConfig(maxTimeoutDistance int32) batchConfig {
return batchConfig{
maxTimeoutDistance: maxTimeoutDistance,
noBumping: b.noBumping,
customMuSig2Signer: b.customMuSig2Signer,
}
}