core: add rlock for pendingState read access

This commit is contained in:
rjl493456442 2019-07-16 17:01:28 +08:00
parent 3f60e5b215
commit b49f3bf2c5

View file

@ -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)
}