@@ -654,6 +654,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
654654 params : input .params ,
655655 }
656656 s .pendingInputs [outpoint ] = pendInput
657+ log .Tracef ("input %v added to pendingInputs" , outpoint )
657658
658659 // Start watching for spend of this input, either by us
659660 // or the remote party.
@@ -674,6 +675,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
674675 if err := s .scheduleSweep (bestHeight ); err != nil {
675676 log .Errorf ("schedule sweep: %v" , err )
676677 }
678+ log .Tracef ("input %v scheduled" , outpoint )
677679
678680 // A spend of one of our inputs is detected. Signal sweep
679681 // results to the caller(s).
@@ -1145,7 +1147,7 @@ func (s *UtxoSweeper) scheduleSweep(currentHeight int32) error {
11451147 // The timer is already ticking, no action needed for the sweep to
11461148 // happen.
11471149 if s .timer != nil {
1148- log .Debugf ("Timer still ticking" )
1150+ log .Debugf ("Timer still ticking at height=%v" , currentHeight )
11491151 return nil
11501152 }
11511153
@@ -1338,9 +1340,14 @@ func (s *UtxoSweeper) sweep(inputs inputSet, feeRate chainfee.SatPerKWeight,
13381340 return fmt .Errorf ("publish tx: %v" , err )
13391341 }
13401342
1341- // Keep the output script in case of an error, so that it can be reused
1342- // for the next transaction and causes no address inflation.
1343- if err == nil {
1343+ // Otherwise log the error.
1344+ if err != nil {
1345+ log .Errorf ("Publish sweep tx %v got error: %v" , tx .TxHash (),
1346+ err )
1347+ } else {
1348+ // If there's no error, remove the output script. Otherwise
1349+ // keep it so that it can be reused for the next transaction
1350+ // and causes no address inflation.
13441351 s .currentOutputScript = nil
13451352 }
13461353
@@ -1375,6 +1382,11 @@ func (s *UtxoSweeper) sweep(inputs inputSet, feeRate chainfee.SatPerKWeight,
13751382 nextAttemptDelta )
13761383
13771384 if pi .publishAttempts >= s .cfg .MaxSweepAttempts {
1385+ log .Warnf ("input %v: publishAttempts(%v) exceeds " +
1386+ "MaxSweepAttempts(%v), removed" ,
1387+ input .PreviousOutPoint , pi .publishAttempts ,
1388+ s .cfg .MaxSweepAttempts )
1389+
13781390 // Signal result channels sweep result.
13791391 s .signalAndRemove (& input .PreviousOutPoint , Result {
13801392 Err : ErrTooManyAttempts ,
@@ -1390,7 +1402,8 @@ func (s *UtxoSweeper) sweep(inputs inputSet, feeRate chainfee.SatPerKWeight,
13901402func (s * UtxoSweeper ) waitForSpend (outpoint wire.OutPoint ,
13911403 script []byte , heightHint uint32 ) (func (), error ) {
13921404
1393- log .Debugf ("Wait for spend of %v" , outpoint )
1405+ log .Tracef ("Wait for spend of %v at heightHint=%v" ,
1406+ outpoint , heightHint )
13941407
13951408 spendEvent , err := s .cfg .Notifier .RegisterSpendNtfn (
13961409 & outpoint , script , heightHint ,
0 commit comments