eth/protocols/snap, p2p/discover: improve zero time checks (#32214)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This commit is contained in:
asamuj 2025-07-15 14:20:45 +08:00 committed by GitHub
parent 7364e63ef9
commit d7db10ddbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View file

@ -615,7 +615,7 @@ func (s *Syncer) Sync(root common.Hash, cancel chan struct{}) error {
s.statelessPeers = make(map[string]struct{})
s.lock.Unlock()
if s.startTime == (time.Time{}) {
if s.startTime.IsZero() {
s.startTime = time.Now()
}
// Retrieve the previous sync status from LevelDB and abort if already synced
@ -1987,9 +1987,7 @@ func (s *Syncer) processAccountResponse(res *accountResponse) {
func (s *Syncer) processBytecodeResponse(res *bytecodeResponse) {
batch := s.db.NewBatch()
var (
codes uint64
)
var codes uint64
for i, hash := range res.hashes {
code := res.codes[i]

View file

@ -562,7 +562,7 @@ func (tab *Table) addReplacement(b *bucket, n *enode.Node) {
}
func (tab *Table) nodeAdded(b *bucket, n *tableNode) {
if n.addedToTable == (time.Time{}) {
if n.addedToTable.IsZero() {
n.addedToTable = time.Now()
}
n.addedToBucket = time.Now()