This PR addresses an "edge case" issue that arises when a sovereign chain’s round duration is greater than the main chain’s and incoming headers are quickly added to the pool. Due to go routines notifying the pool and process handlers asynchronously, it’s possible for an extended header with nonce X+2 to be added before one with nonce X+1.
When the function doJobOnReceivedCrossNotarizedHeader receives a new main chain header, it notifies all relevant handlers via crossBlockNotifier, which then calls ComputeLongestChain. If a header with nonce X+2 is processed first, unnecessary network requests are made to receive headers with nonce X+1.
Proposed changes
In normal processing chain code, if we have no registered handler inside crossBlockNotifier,we return early
We also have no registered handler, so returned earlier .
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
was the PR targeted to the correct branch?
if this is a larger feature that probably needs more than one PR, is there a feat branch created?
if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?
Reasoning behind the pull request
X+2
to be added before one with nonceX+1
.doJobOnReceivedCrossNotarizedHeader
receives a new main chain header, it notifies all relevant handlers viacrossBlockNotifier
, which then callsComputeLongestChain
. If a header with nonce X+2 is processed first, unnecessary network requests are made to receive headers with nonce X+1.Proposed changes
crossBlockNotifier
,we return earlyTesting procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?