Skip to content

Commit 034eb0c

Browse files
mhanson-githubafostr
authored andcommitted
Fix for activeCycle crash.
1 parent 120163f commit 034eb0c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/state-manager/TransactionQueue.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,8 +2112,14 @@ class TransactionQueue {
21122112
txQueueEntry.txGroupCycle = cycleNumber
21132113
cycleShardData = this.stateManager.shardValuesByCycle.get(cycleNumber)
21142114
}
2115-
txQueueEntry.txDebug.cycleSinceActivated =
2116-
cycleNumber - activeByIdOrder.find((node) => node.id === Self.id).activeCycle
2115+
const selfNode = activeByIdOrder.find((node) => node.id === Self.id)
2116+
if (selfNode) {
2117+
txQueueEntry.txDebug.cycleSinceActivated = cycleNumber - selfNode.activeCycle
2118+
} else {
2119+
// Node not found in active list - could be syncing or in another state
2120+
/* prettier-ignore */ if (logFlags.verbose) this.mainLogger.warn(`routeAndQueueAcceptedTransaction: Node ${Self.id} not found in activeByIdOrder list. Setting cycleSinceActivated to 0`)
2121+
txQueueEntry.txDebug.cycleSinceActivated = 0
2122+
}
21172123

21182124
if (cycleShardData == null) {
21192125
/* prettier-ignore */ if (logFlags.error) this.mainLogger.error(`routeAndQueueAcceptedTransaction logID:${txQueueEntry.logID} cycleShardData == null cycle:${cycleNumber} not putting tx in queue.`)

0 commit comments

Comments
 (0)