fix nil txPointer when delete transaction from mempool

This commit is contained in:
Lizen 2020-09-27 17:00:47 +08:00
parent 940f6857d0
commit d6c101e0a6
1 changed files with 5 additions and 0 deletions

View File

@ -397,6 +397,11 @@ func (mpi *mempoolImpl) processCommitTransactions(ready *raftproto.Ready) {
for _, txHash := range ready.TxHashes {
txHashStr := txHash.Hex()
txPointer := mpi.txStore.txHashMap[txHashStr]
txPointer, ok := mpi.txStore.txHashMap[txHashStr]
if !ok {
mpi.logger.Warningf("Remove transaction %s failed, Can't find it from txHashMap", txHashStr)
continue
}
preCommitNonce := mpi.txStore.nonceCache.getCommitNonce(txPointer.account)
newCommitNonce := txPointer.nonce + 1
if preCommitNonce < newCommitNonce {