Skip to content

Commit b15abc9

Browse files
committed
tapgarden: stop caretaker on confirmation err
In this commit, we update the TX confirmation handling logic to stop the caretaker if confirmation registration fails. At that point, the caretaker cannot successfully receive a confirmation for the broadcast batch, so it should shut down to allow caretaker restart for the same batch. Note that the planter will not actually delete the stopped caretaker, as the error is not sent on BroadcastErrChan.
1 parent 6d0d935 commit b15abc9

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tapgarden/caretaker.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,13 +879,14 @@ func (b *BatchCaretaker) stateStep(currentState BatchState) (BatchState, error)
879879
for !confRecv {
880880
select {
881881
case confEvent = <-confNtfn.Confirmed:
882-
log.Debugf("Got chain confirmation: %v",
883-
confEvent.Tx.TxHash())
884882
confRecv = true
885883

886884
case err := <-errChan:
887-
b.cfg.ErrChan <- fmt.Errorf("error "+
888-
"getting confirmation: %w", err)
885+
confErr := fmt.Errorf("error getting "+
886+
"confirmation: %w", err)
887+
log.Info(confErr)
888+
b.cfg.ErrChan <- confErr
889+
889890
return
890891

891892
case <-confCtx.Done():
@@ -911,11 +912,19 @@ func (b *BatchCaretaker) stateStep(currentState BatchState) (BatchState, error)
911912
}
912913

913914
if confEvent == nil {
914-
b.cfg.ErrChan <- fmt.Errorf("got empty " +
915+
confErr := fmt.Errorf("got empty " +
915916
"confirmation event in batch")
917+
log.Info(confErr)
918+
b.cfg.ErrChan <- confErr
919+
916920
return
917921
}
918922

923+
if confEvent.Tx != nil {
924+
log.Debugf("Got chain confirmation: %v",
925+
confEvent.Tx.TxHash())
926+
}
927+
919928
for {
920929
select {
921930
case b.confEvent <- confEvent:

0 commit comments

Comments
 (0)