-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GetBodiesFromPeerTask #8040
base: main
Are you sure you want to change the base?
Add GetBodiesFromPeerTask #8040
Conversation
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…e available Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tantiation Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…en initializing PeerTaskFeatureToggle multiple times Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…peertask-system' into 7311-add-cli-feature-toggle-for-peertask-system
…tem' into 7311-add-GetReceiptsFromPeerTask
…' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…tem' into 7311-add-GetReceiptsFromPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… update unit test to test for this functionality Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…PoS, remove new usages of currentProtocolSpecSupplier Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…sPeerTask # Conflicts: # ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/checkpointsync/CheckpointDownloadBlockStep.java
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
…to GetBodiesPeerTask
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
… spotless Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
return protocolSchedule.getByBlockHeader(header).getWithdrawalsProcessor().isPresent(); | ||
} | ||
|
||
public List<Block> getBlocks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name doesn't make it clear this is downloading blocks when called, it looks like a getter.
Maybe downloadBlocks
would be better?
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class GetBodiesFromPeerTask implements PeerTask<List<Block>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add Javadoc description to this class like the other GetBodiesFromPeerTask
private final List<BlockHeader> headersToGet = new ArrayList<>(); | ||
private final PeerTaskExecutor peerTaskExecutor; | ||
|
||
private final Block[] result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is an array being used to hold the results instead of a List?
remainingBlocks--; | ||
result[nextIndex] = block; | ||
headersToGet.removeFirst(); | ||
nextIndex = findNextIndex(nextIndex + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is findNextIndex needed here? Is this to skip prepopulated empty headers?
PR description
Adds GetBodiesFromPeerTask for use with the peer task system to help move away from the cumbersome EthTask class hierarchy. Includes work from both myself (@Matilda-Clerke) and @pinges