Skip to content

Commit

Permalink
Ability to reset the nonce count if an error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznecovas committed Apr 9, 2020
1 parent 5704871 commit 1ef47ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/nonce_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ func (nt *NonceTracker) GetNonce(ctx context.Context, account common.Address) (u
nt.nonces[account] = nonce
return nonce, nil
}

// ForceReloadNonce clears the nonce cache. This will force loading from BC next time.
func (nt *NonceTracker) ForceReloadNonce(account common.Address) {
nt.nonceLock.Lock()
defer nt.nonceLock.Unlock()
delete(nt.nonces, account)
}

0 comments on commit 1ef47ff

Please sign in to comment.