Skip to content
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

Only stop block propagation, not tx handling. #4186

Merged
merged 9 commits into from
Jul 29, 2022

Conversation

jflo
Copy link
Contributor

@jflo jflo commented Jul 27, 2022

PR description

Since there is a Subscribers for each type of message handler in EthMessages, and only on handler, they all get a subscriber id of 1. This changes the unsubscribe logic to require the caller to specify the message code handler being unsubscribed from, and removes it from the map of handlers.

Fixed Issue(s)

fixes #3890

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. one suggestion on using consts in test

@@ -815,6 +815,8 @@ public void shouldStopWhenTTDReached() {
blockPropagationManager.start();
syncState.setReachedTerminalDifficulty(true);
assertThat(blockPropagationManager.isRunning()).isFalse();
assertThat(ethProtocolManager.ethContext().getEthMessages().messageCodesHandled())
.doesNotContain(1, 7);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth a comment to say what 1 and 7 are here, or use constants EthPV62.NEW_BLOCK

Comment on lines +147 to +149
newBlockSId.ifPresent(id -> ethContext.getEthMessages().unsubscribe(id, EthPV62.NEW_BLOCK));
newBlockHashesSId.ifPresent(
id -> ethContext.getEthMessages().unsubscribe(id, EthPV62.NEW_BLOCK_HASHES));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that the subscriber id for BlockPropagationManager was the same as the id for transaction pool right?

I wonder how many other places we could have this problem (where we expect the subscriber id to be unique across Subcribers instances).

Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jflo jflo enabled auto-merge (squash) July 29, 2022 15:44
@jflo jflo merged commit 992534e into hyperledger:main Jul 29, 2022
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* on block propagation stop, only kill the new block and new block hash handlers, leave all others (especially txs) alone

Signed-off-by: Justin Florentine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge bug: besu producing zero transaction blocks
3 participants