@@ -535,13 +535,15 @@ func (b *Batcher) Run(ctx context.Context) error {
535
535
case sweepReq := <- b .sweepReqs :
536
536
sweep , err := b .fetchSweep (runCtx , sweepReq )
537
537
if err != nil {
538
- log .Warnf ("fetchSweep failed: %v." , err )
538
+ log ().Warnf ("fetchSweep failed: %v." , err )
539
+
539
540
return err
540
541
}
541
542
542
543
err = b .handleSweep (runCtx , sweep , sweepReq .Notifier )
543
544
if err != nil {
544
- log .Warnf ("handleSweep failed: %v." , err )
545
+ log ().Warnf ("handleSweep failed: %v." , err )
546
+
545
547
return err
546
548
}
547
549
@@ -550,11 +552,13 @@ func (b *Batcher) Run(ctx context.Context) error {
550
552
close (testReq .quit )
551
553
552
554
case err := <- b .errChan :
553
- log .Warnf ("Batcher received an error: %v." , err )
555
+ log ().Warnf ("Batcher received an error: %v." , err )
556
+
554
557
return err
555
558
556
559
case <- runCtx .Done ():
557
- log .Infof ("Stopping Batcher: run context cancelled." )
560
+ log ().Infof ("Stopping Batcher: run context cancelled." )
561
+
558
562
return runCtx .Err ()
559
563
}
560
564
}
@@ -612,8 +616,8 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
612
616
return err
613
617
}
614
618
615
- log .Infof ("Batcher handling sweep %x, completed=%v" , sweep . swapHash [: 6 ] ,
616
- completed )
619
+ log () .Infof ("Batcher handling sweep %x, completed=%v" ,
620
+ sweep . swapHash [: 6 ], completed )
617
621
618
622
// If the sweep has already been completed in a confirmed batch then we
619
623
// can't attach its notifier to the batch as that is no longer running.
@@ -624,8 +628,8 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
624
628
// on-chain confirmations to prevent issues caused by reorgs.
625
629
parentBatch , err := b .store .GetParentBatch (ctx , sweep .swapHash )
626
630
if err != nil {
627
- log .Errorf ("unable to get parent batch for sweep %x: " +
628
- "%v" , sweep .swapHash [:6 ], err )
631
+ log () .Errorf ("unable to get parent batch for sweep %x:" +
632
+ " %v" , sweep .swapHash [:6 ], err )
629
633
630
634
return err
631
635
}
@@ -677,8 +681,8 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
677
681
return nil
678
682
}
679
683
680
- log .Warnf ("Greedy batch selection algorithm failed for sweep %x: %v. " +
681
- "Falling back to old approach." , sweep .swapHash [:6 ], err )
684
+ log () .Warnf ("Greedy batch selection algorithm failed for sweep %x: %v." +
685
+ " Falling back to old approach." , sweep .swapHash [:6 ], err )
682
686
683
687
// If one of the batches accepts the sweep, we provide it to that batch.
684
688
for _ , batch := range b .batches {
@@ -783,13 +787,13 @@ func (b *Batcher) spinUpBatchFromDB(ctx context.Context, batch *batch) error {
783
787
}
784
788
785
789
if len (dbSweeps ) == 0 {
786
- log .Infof ("skipping restored batch %d as it has no sweeps" ,
790
+ log () .Infof ("skipping restored batch %d as it has no sweeps" ,
787
791
batch .id )
788
792
789
793
// It is safe to drop this empty batch as it has no sweeps.
790
794
err := b .store .DropBatch (ctx , batch .id )
791
795
if err != nil {
792
- log .Warnf ("unable to drop empty batch %d: %v" ,
796
+ log () .Warnf ("unable to drop empty batch %d: %v" ,
793
797
batch .id , err )
794
798
}
795
799
@@ -931,7 +935,7 @@ func (b *Batcher) monitorSpendAndNotify(ctx context.Context, sweep *sweep,
931
935
b .wg .Add (1 )
932
936
go func () {
933
937
defer b .wg .Done ()
934
- log .Infof ("Batcher monitoring spend for swap %x" ,
938
+ log () .Infof ("Batcher monitoring spend for swap %x" ,
935
939
sweep .swapHash [:6 ])
936
940
937
941
for {
@@ -1110,7 +1114,7 @@ func (b *Batcher) loadSweep(ctx context.Context, swapHash lntypes.Hash,
1110
1114
}
1111
1115
} else {
1112
1116
if s .ConfTarget == 0 {
1113
- log .Warnf ("Fee estimation was requested for zero " +
1117
+ log () .Warnf ("Fee estimation was requested for zero " +
1114
1118
"confTarget for sweep %x." , swapHash [:6 ])
1115
1119
}
1116
1120
minFeeRate , err = b .wallet .EstimateFeeRate (ctx , s .ConfTarget )
0 commit comments