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

Cancel all mempool download and verify tasks when a network upgrade activates #2710

Closed
Tracked by #2309
teor2345 opened this issue Aug 31, 2021 · 4 comments · Fixed by #2816
Closed
Tracked by #2309

Cancel all mempool download and verify tasks when a network upgrade activates #2710

teor2345 opened this issue Aug 31, 2021 · 4 comments · Fixed by #2816
Assignees

Comments

@teor2345
Copy link
Contributor

teor2345 commented Aug 31, 2021

Motivation

When a network upgrade activates, the mempool needs to redo validation with the new consensus rules.

Design

Tasks can await network upgrade activation using ChainTipChange::tip_change and TipAction::Reset:

pub async fn tip_change(&mut self) -> Result<TipAction, watch::error::RecvError> {

@mpguerra
Copy link
Contributor

mpguerra commented Sep 1, 2021

@mpguerra mpguerra added this to the 2021 Sprint 19 milestone Sep 15, 2021
@mpguerra
Copy link
Contributor

our approach will depend on what we do for #2374

@mpguerra mpguerra added the S-blocked Status: Blocked on other tasks label Sep 27, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Sep 30, 2021

Currently Zebra:

  • clears the mempool storage at network upgrade activation
  • fetches transactions from peers using the mempool crawler
  • validates those transactions using the new consensus rules using the mempool downloader

So I think the only thing that's missing here is clearing the download and verify queue.

The state send a Reset if there is a network upgrade activation.
In PR #2773, we cleared the storage on Reset, but not the download queue.

if let Some(tip_action) = self.chain_tip_change.last_tip_change() {
match tip_action {
// Clear the mempool if there has been a chain tip reset.
TipAction::Reset { .. } => {
storage.clear();
}

@teor2345 teor2345 removed the S-blocked Status: Blocked on other tasks label Sep 30, 2021
@teor2345
Copy link
Contributor Author

Edit: actually, it seems like we're missing clearing the download & verify stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants