eth/downloader: hold pivotLock when marking pivot committed (#35405)

commitPivotBlock updated committed without pivotLock, while other pivot
transitions serialize through that lock. Take the lock around the store
to keep pivot commitment consistent with pivotHeader updates.
This commit is contained in:
cui 2026-07-24 16:19:35 +08:00 committed by GitHub
parent a524f2bb17
commit cd65ccad96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1109,7 +1109,9 @@ func (d *Downloader) commitPivotBlock(result *fetchResult) error {
if err := d.blockchain.SnapSyncComplete(block.Hash(), d.snapSyncer.Version() == snap.SNAP2); err != nil {
return err
}
d.pivotLock.Lock()
d.committed.Store(true)
d.pivotLock.Unlock()
// The chain has obtained a stateful head by committing the pivot block,
// the mission of the snap sync is regarded as accomplished and the mode