Skip to content

Commit a41137d

Browse files
authored
core: don't cache zero nonce in txNoncer (scroll-tech#88)
* core: don't cache zero nonce in txNoncer (ethereum#25603) * revert change
1 parent ca14e80 commit a41137d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/tx_noncer.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ func (txn *txNoncer) get(addr common.Address) uint64 {
4949
defer txn.lock.Unlock()
5050

5151
if _, ok := txn.nonces[addr]; !ok {
52-
txn.nonces[addr] = txn.fallback.GetNonce(addr)
52+
if nonce := txn.fallback.GetNonce(addr); nonce != 0 {
53+
txn.nonces[addr] = nonce
54+
}
5355
}
5456
return txn.nonces[addr]
5557
}
@@ -70,7 +72,9 @@ func (txn *txNoncer) setIfLower(addr common.Address, nonce uint64) {
7072
defer txn.lock.Unlock()
7173

7274
if _, ok := txn.nonces[addr]; !ok {
73-
txn.nonces[addr] = txn.fallback.GetNonce(addr)
75+
if nonce := txn.fallback.GetNonce(addr); nonce != 0 {
76+
txn.nonces[addr] = nonce
77+
}
7478
}
7579
if txn.nonces[addr] <= nonce {
7680
return

0 commit comments

Comments
 (0)