@@ -535,13 +535,15 @@ func (b *Batcher) Run(ctx context.Context) error {
535535 case sweepReq := <- b .sweepReqs :
536536 sweep , err := b .fetchSweep (runCtx , sweepReq )
537537 if err != nil {
538- log .Warnf ("fetchSweep failed: %v." , err )
538+ log ().Warnf ("fetchSweep failed: %v." , err )
539+
539540 return err
540541 }
541542
542543 err = b .handleSweep (runCtx , sweep , sweepReq .Notifier )
543544 if err != nil {
544- log .Warnf ("handleSweep failed: %v." , err )
545+ log ().Warnf ("handleSweep failed: %v." , err )
546+
545547 return err
546548 }
547549
@@ -550,11 +552,13 @@ func (b *Batcher) Run(ctx context.Context) error {
550552 close (testReq .quit )
551553
552554 case err := <- b .errChan :
553- log .Warnf ("Batcher received an error: %v." , err )
555+ log ().Warnf ("Batcher received an error: %v." , err )
556+
554557 return err
555558
556559 case <- runCtx .Done ():
557- log .Infof ("Stopping Batcher: run context cancelled." )
560+ log ().Infof ("Stopping Batcher: run context cancelled." )
561+
558562 return runCtx .Err ()
559563 }
560564 }
@@ -612,8 +616,8 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
612616 return err
613617 }
614618
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 )
617621
618622 // If the sweep has already been completed in a confirmed batch then we
619623 // 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,
624628 // on-chain confirmations to prevent issues caused by reorgs.
625629 parentBatch , err := b .store .GetParentBatch (ctx , sweep .swapHash )
626630 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 )
629633
630634 return err
631635 }
@@ -677,8 +681,8 @@ func (b *Batcher) handleSweep(ctx context.Context, sweep *sweep,
677681 return nil
678682 }
679683
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 )
682686
683687 // If one of the batches accepts the sweep, we provide it to that batch.
684688 for _ , batch := range b .batches {
@@ -783,13 +787,13 @@ func (b *Batcher) spinUpBatchFromDB(ctx context.Context, batch *batch) error {
783787 }
784788
785789 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" ,
787791 batch .id )
788792
789793 // It is safe to drop this empty batch as it has no sweeps.
790794 err := b .store .DropBatch (ctx , batch .id )
791795 if err != nil {
792- log .Warnf ("unable to drop empty batch %d: %v" ,
796+ log () .Warnf ("unable to drop empty batch %d: %v" ,
793797 batch .id , err )
794798 }
795799
@@ -931,7 +935,7 @@ func (b *Batcher) monitorSpendAndNotify(ctx context.Context, sweep *sweep,
931935 b .wg .Add (1 )
932936 go func () {
933937 defer b .wg .Done ()
934- log .Infof ("Batcher monitoring spend for swap %x" ,
938+ log () .Infof ("Batcher monitoring spend for swap %x" ,
935939 sweep .swapHash [:6 ])
936940
937941 for {
@@ -1110,7 +1114,7 @@ func (b *Batcher) loadSweep(ctx context.Context, swapHash lntypes.Hash,
11101114 }
11111115 } else {
11121116 if s .ConfTarget == 0 {
1113- log .Warnf ("Fee estimation was requested for zero " +
1117+ log () .Warnf ("Fee estimation was requested for zero " +
11141118 "confTarget for sweep %x." , swapHash [:6 ])
11151119 }
11161120 minFeeRate , err = b .wallet .EstimateFeeRate (ctx , s .ConfTarget )
0 commit comments