Skip to content

feat(chain)!: Use a more granular state machine for IBD#1095

Open
Davidson-Souza wants to merge 1 commit into
getfloresta:masterfrom
Davidson-Souza:feat/ibd-enum
Open

feat(chain)!: Use a more granular state machine for IBD#1095
Davidson-Souza wants to merge 1 commit into
getfloresta:masterfrom
Davidson-Souza:feat/ibd-enum

Conversation

@Davidson-Souza
Copy link
Copy Markdown
Member

@Davidson-Souza Davidson-Souza commented May 27, 2026

Description and Notes

Related to #1089

Instead of just true/false, this commit tells where we are on IBD. It can either be DownloadingHeaders,DownloadingBlocks or Done.

Comment thread crates/floresta-chain/src/pruned_utreexo/partial_chain.rs Outdated
Comment thread crates/floresta-chain/src/pruned_utreexo/partial_chain.rs Outdated
Comment thread crates/floresta-chain/src/extensions.rs Outdated
Comment thread crates/floresta-chain/src/pruned_utreexo/mod.rs Outdated
Comment thread crates/floresta-chain/src/pruned_utreexo/chain_state.rs Outdated
Comment thread crates/floresta-chain/src/pruned_utreexo/chain_state.rs Outdated
Comment thread crates/floresta-chain/src/pruned_utreexo/mod.rs Outdated
Comment thread crates/floresta-wire/src/p2p_wire/node/chain_selector_ctx.rs Outdated
@Davidson-Souza
Copy link
Copy Markdown
Member Author

Pushed 5a48287:

  • Removing full paths
  • Adding and updating docs
  • removing unrelated change in wire

@luisschwab
Copy link
Copy Markdown
Member

luisschwab commented Jun 2, 2026

I think IBDState should be even more granular, and should also report the backfill status eg:

pub enum IBDSate {
    HeaderSync(u32), // header height

    BlockDownload(u32), // block height

    Backfill(u32), // backfill height

    Done,
}

Or maybe even:

pub enum IBDSate {
    HeaderSync(u32), // header height

    BlockDownload(u32), // block height

    Done { backfill: Option<u32> },
}

@Davidson-Souza
Copy link
Copy Markdown
Member Author

I think IBDState should be even more granular, and should also report the backfill status eg:

pub enum IBDSate {
    HeaderSync(u32), // header height

    BlockDownload(u32), // block height

    Backfill(u32), // backfill height

    Done,
}

Or maybe even:

pub enum IBDSate {
    HeaderSync(u32), // header height

    BlockDownload(u32), // block height

    Done { backfill: Option<u32> },
}

Backfill is harder because it uses a partial chainstate instead of the regular one. We would need to propagate progress back to the node and into the chain to know that. The others are fine.

@Davidson-Souza
Copy link
Copy Markdown
Member Author

Davidson-Souza commented Jun 3, 2026

Actually, is this really needed? You can get this from already existing methods.

Edit: if this was a notification it would make more sense

Instead of just true/false, this commit tells where we are on IBD.
It can either be DownloadingHeaders, DowloadingBlocks or Done.
@Davidson-Souza
Copy link
Copy Markdown
Member Author

Fixed a typo with the enum name.

@@ -130,7 +116,7 @@ impl<T: ChainStore> ChainStateBuilder<T> {
}

/// Enable or disable Initial Block Download (IBD) mode.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this comment needs to be changed, because now it sets the IBD status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants