Skip to content

feat(node): Add GetCFHeaders to the node handle#1088

Open
Davidson-Souza wants to merge 1 commit into
getfloresta:masterfrom
Davidson-Souza:feat/cfilter-headers
Open

feat(node): Add GetCFHeaders to the node handle#1088
Davidson-Souza wants to merge 1 commit into
getfloresta:masterfrom
Davidson-Souza:feat/cfilter-headers

Conversation

@Davidson-Souza
Copy link
Copy Markdown
Member

Split off from #1079

This message allows fetching Compact Block Filter Headers from some peer, and will be used both for implemeting the equivalent RPC and by #1079 to sync the filter header store.

Changelog

 - Implemented `get_cfilter_headers` for the node handle
 - Implemented all the heavy-lifting to make requests work

@Davidson-Souza Davidson-Souza added this to the Q2/2026 milestone May 26, 2026
@Davidson-Souza Davidson-Souza self-assigned this May 26, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Floresta May 26, 2026
@Davidson-Souza Davidson-Souza added the ecosystem support Enable interoperability, compatibility and practical integration with the broader Bitcoin ecosystem label May 26, 2026
@luisschwab luisschwab self-requested a review May 26, 2026 20:27
Copy link
Copy Markdown
Member

@jaoleal jaoleal left a comment

Choose a reason for hiding this comment

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

Just some docs missing.

This is only the wiring right ? So, no way to test this ?

/// Remote peer sent us a Utreexo proof,
UtreexoProof(UtreexoProof),

CFHeaders(CFHeaders),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
CFHeaders(CFHeaders),
/// Remote peer sent us compact block filter headers
CFHeaders(CFHeaders),

/// leaf data are the actual data of the leaves (i.e., the txouts).
GetBlockProof((BlockHash, Bitmap, Bitmap)),

GetCFHeaders {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Docs

extract_variant!(Ping, val)
}

pub async fn get_cfilters_headers(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Docs

return Err(PeerError::MessageTooBig);
}

if cfheaders.filter_type != 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if cfheaders.filter_type != 0 {
if cfheaders.filter_type != BASIC_FILTER_VERSION {

Comment on lines +111 to 116

GetCFHeaders {
start_height: u32,
stop_hash: BlockHash,
},
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rust-bitcoin already implements this: https://github.com/rust-bitcoin/rust-bitcoin/blob/master/p2p/src/message_filter.rs#L236-L245

/// getcfheaders message
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct GetCFHeaders {
    /// Byte identifying the type of filter being returned
    pub filter_type: u8,
    /// The height of the first block in the requested range
    pub start_height: BlockHeight,
    /// The hash of the last block in the requested range
    pub stop_hash: BlockHash,
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This method doesn't allow you to pick the filter type. Is this useful in any kind?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not currently, but you can just hardcode filter_type to 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, we can't use it because it doesn't implement Hash.

This message allows fetching Compact Block Filter Headers from
some peer, and will be used both for implemeting the equivalent
RPC and by getfloresta#1079 to sync the filter header store.
@Davidson-Souza Davidson-Souza force-pushed the feat/cfilter-headers branch from f80e83a to a901701 Compare June 3, 2026 21:11
@Davidson-Souza
Copy link
Copy Markdown
Member Author

Pushed a901701:

  • Rebased
  • Added more docs
  • Used constants where applicable

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

Labels

ecosystem support Enable interoperability, compatibility and practical integration with the broader Bitcoin ecosystem

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants