engine_v2: fix data race when initial v2 parameters, close XFN-10 (#1617)

This commit is contained in:
Daniel Liu 2025-10-31 14:03:06 +08:00 committed by GitHub
parent 689ac1b12a
commit 20ec25c0ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,6 +178,9 @@ func (x *XDPoS_v2) SignHash(header *types.Header) (hash common.Hash) {
// Initial V2 related parameters
func (x *XDPoS_v2) Initial(chain consensus.ChainReader, header *types.Header) error {
x.lock.Lock()
defer x.lock.Unlock()
return x.initial(chain, header)
}