Legacy header handling is dispatched with go sm.handleHeadersMsg(msg) in services/legacy/netsync/manager.go, while headerList, startHeader, and nextCheckpoint are also accessed by block delivery, sync reset, and peer handling without a common lock. The atomic headersFirstMode flag does not protect those fields or the linked list.
Concurrent header messages can race with each other and with checkpoint advancement/reset. The security review reported race-detector findings and list corruption; this issue records that reported result, rather than claiming a new concurrency reproduction. Static inspection confirms the shared, unsynchronized accesses.
Give header state a single owner or a consistent locking discipline. Cover all reads and mutations, including reset, request construction, checkpoint advancement, and diagnostics. Avoid holding a state lock across the minutes-long block-validation path or network/store waits where practical.
Acceptance: concurrency tests overlap header receipt, block delivery, peer rotation, and reset; run them with -race, assert list/cursor consistency, and verify checkpoint provenance is only granted for a matched header run. Preserve initial-download throughput.
Legacy header handling is dispatched with
go sm.handleHeadersMsg(msg)inservices/legacy/netsync/manager.go, whileheaderList,startHeader, andnextCheckpointare also accessed by block delivery, sync reset, and peer handling without a common lock. The atomicheadersFirstModeflag does not protect those fields or the linked list.Concurrent header messages can race with each other and with checkpoint advancement/reset. The security review reported race-detector findings and list corruption; this issue records that reported result, rather than claiming a new concurrency reproduction. Static inspection confirms the shared, unsynchronized accesses.
Give header state a single owner or a consistent locking discipline. Cover all reads and mutations, including reset, request construction, checkpoint advancement, and diagnostics. Avoid holding a state lock across the minutes-long block-validation path or network/store waits where practical.
Acceptance: concurrency tests overlap header receipt, block delivery, peer rotation, and reset; run them with
-race, assert list/cursor consistency, and verify checkpoint provenance is only granted for a matched header run. Preserve initial-download throughput.