go-ethereum/eth/protocols
rayoo eeea65fe1d eth/protocols/snap: fix data race on testPeer counters
The testPeer request counters (nAccountRequests, nStorageRequests,
nBytecodeRequests, nTrienodeRequests) were plain int fields
incremented with ++. These increments happen in Request* methods
that are invoked concurrently by the Syncer from multiple goroutines
(assignBytecodeTasks, assignStorageTasks, etc.), causing a data
race reliably detected by go test -race.

Change the counters to atomic.Int64 so increments and reads are
synchronized without introducing a mutex.

Fixes races detected in TestMultiSyncManyUseless,
TestMultiSyncManyUselessWithLowTimeout,
TestMultiSyncManyUnresponsive, TestSyncWithStorageAndOneCappedPeer,
TestSyncWithStorageAndCorruptPeer, and
TestSyncWithStorageAndNonProvingPeer.
2026-04-23 15:09:00 +08:00
..
eth core, eth/protocols/snap: Snap/2 Protocol + BAL Serving (#34083) 2026-04-03 14:10:32 +08:00
snap eth/protocols/snap: fix data race on testPeer counters 2026-04-23 15:09:00 +08:00