-
Notifications
You must be signed in to change notification settings - Fork 834
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
Conversation
… handlers, leave all others (especially txs) alone Signed-off-by: Justin Florentine <[email protected]>
Signed-off-by: Justin Florentine <[email protected]>
Signed-off-by: Justin Florentine <[email protected]>
…890-retain-tx-handlers
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.
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); | |||
} |
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.
maybe worth a comment to say what 1 and 7 are here, or use constants EthPV62.NEW_BLOCK
newBlockSId.ifPresent(id -> ethContext.getEthMessages().unsubscribe(id, EthPV62.NEW_BLOCK)); | ||
newBlockHashesSId.ifPresent( | ||
id -> ethContext.getEthMessages().unsubscribe(id, EthPV62.NEW_BLOCK_HASHES)); |
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.
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).
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.
LGTM 👍
Signed-off-by: Justin Florentine <[email protected]>
Signed-off-by: Justin Florentine <[email protected]>
…890-retain-tx-handlers
* 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]>
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
doc-change-required
label to this PR ifupdates are required.
Changelog