From b49f3bf2c5b5284f713c4ceaf189ee4978c150a1 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Tue, 16 Jul 2019 17:01:28 +0800 Subject: [PATCH] core: add rlock for pendingState read access --- core/tx_pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/tx_pool.go b/core/tx_pool.go index f54ab47417..6bcb97b0c6 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -420,6 +420,9 @@ func (pool *TxPool) SetGasPrice(price *big.Int) { // Nonce returns the next nonce of an account, with all transactions executable // by the pool already applied on top. func (pool *TxPool) Nonce(addr common.Address) uint64 { + pool.mu.RLock() + defer pool.mu.RUnlock() + return pool.pendingNonces.get(addr) }