From a40c5e6b5c97829c9a50d2b37716e08fd99cd80e Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Wed, 3 Apr 2024 13:42:24 -0400 Subject: [PATCH] Update tracker.go --- common/txmgr/tracker.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/txmgr/tracker.go b/common/txmgr/tracker.go index 9d7ffda7d95..a8ff377b25d 100644 --- a/common/txmgr/tracker.go +++ b/common/txmgr/tracker.go @@ -47,15 +47,16 @@ type Tracker[ chainID CHAIN_ID lggr logger.Logger + lock sync.Mutex enabledAddrs map[ADDR]bool txCache map[int64]ADDR // cache tx fromAddress by txID - ttl time.Duration - mb *mailbox.Mailbox[int64] - lock sync.Mutex + ttl time.Duration + mb *mailbox.Mailbox[int64] + + initSync sync.Mutex wg sync.WaitGroup chStop services.StopChan - initSync sync.Mutex isStarted bool } @@ -267,6 +268,11 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) handleTxesB tr.lggr.Errorf("failed to get tx by ID: %v", err) continue } + if tx == nil { + tr.lggr.Warnf("tx with ID %v no longer exists, removing from tracker", id) + delete(tr.txCache, tx.ID) + continue + } switch tx.State { case TxConfirmed: