Skip to content

Commit

Permalink
Update tracker.go
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Apr 3, 2024
1 parent 7564bd2 commit a40c5e6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions common/txmgr/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a40c5e6

Please sign in to comment.