We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f5f902 commit 2964504Copy full SHA for 2964504
core/state/managed_state.go
@@ -82,10 +82,12 @@ func (ms *ManagedState) NewNonce(addr common.Address) uint64 {
82
return uint64(len(account.nonces)-1) + account.nstart
83
}
84
85
-// GetNonce returns the canonical nonce for the managed or unmanaged account
+// GetNonce returns the canonical nonce for the managed or unmanaged account.
86
+//
87
+// Because GetNonce mutates the DB, we must take a write lock.
88
func (ms *ManagedState) GetNonce(addr common.Address) uint64 {
- ms.mu.RLock()
- defer ms.mu.RUnlock()
89
+ ms.mu.Lock()
90
+ defer ms.mu.Unlock()
91
92
if ms.hasAccount(addr) {
93
account := ms.getAccount(addr)
0 commit comments