Skip to content

feat(core): make block data generic - #172

Merged
cygnet3 merged 2 commits into
masterfrom
feat/add-generic-blockdata-trait
Sep 14, 2026
Merged

cygnet3 merged 2 commits into
masterfrom
feat/add-generic-blockdata-trait

Conversation

@cygnet3

@cygnet3 cygnet3 commented Sep 10, 2026

Copy link
Copy Markdown
Owner
  • Instead of doing bip158 filter checking on the scanner side, use a BlockData trait that exposes check_match_inputs and check_match_outputs, which implements either bip158 filters or any other type, depending on the backend type
  • Replace ChainBackend::spent_index with detect_spent_outpoints. Instead of having the scanner parse the spent index, move the responsibility to the chain backend.

@Sosthene00

Copy link
Copy Markdown
Collaborator

concept ACK

@sdmg15

sdmg15 commented Sep 11, 2026

Copy link
Copy Markdown

Concept ACK.

The initial backend interface was coupled with blindbit. This is good step towards integrating other backend.
I think I'll rely on this to implement the Frigate one.

@cygnet3 cygnet3 changed the title feat(chain_backend): make block data generic feat(core): make block data generic Sep 12, 2026
@cygnet3
cygnet3 force-pushed the feat/add-generic-blockdata-trait branch from 1f593ed to 16d90e4 Compare September 12, 2026 12:49
@cygnet3
cygnet3 marked this pull request as ready for review September 12, 2026 12:51
@cygnet3
cygnet3 force-pushed the feat/add-generic-blockdata-trait branch from 16d90e4 to 0423c12 Compare September 12, 2026 14:07
Comment thread spdk-core/src/chain/trait.rs Outdated
fn tweaks(&self) -> Vec<PublicKey>;

// temporary, will be dropped later
fn input_hashes_map(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When I initially checked this when it was draft I wanted to mention this. This seems like more specific to blindbit if I'm not mistaken, what do you think about having a default implementation?

Comment thread spdk-wallet/src/scanner/scanner.rs Outdated
Comment thread spdk-wallet/tests/mock/chain.rs Outdated
@cygnet3
cygnet3 force-pushed the feat/add-generic-blockdata-trait branch from 0423c12 to 23ae37a Compare September 12, 2026 22:57
Instead of doing all bip158 filter checking on the spdk-wallet side, the
scanner should accept any generic input/output checking, whether we use
bip158 or not.

Instead of returning the Filters in a BlockData struct and have the
scanner check for matches, we keep the BlockData struct generic (it is
now a Trait). This trait exposes 'check_block_inputs' and
'check_block_outputs' functions, which internally use either bip158 or
whatever else.
Instead of having the chain backend return a spent_index, which is
interpreted by the scanner, have the chain backend expose an endpoint
for detecting all spent outpoints at the given block height.
@cygnet3
cygnet3 force-pushed the feat/add-generic-blockdata-trait branch from 23ae37a to 459929d Compare September 12, 2026 23:21

@sdmg15 sdmg15 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tAck 459929d

@cygnet3
cygnet3 merged commit c4f918c into master Sep 14, 2026
2 checks passed
@cygnet3
cygnet3 deleted the feat/add-generic-blockdata-trait branch September 14, 2026 14:55
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 this pull request may close these issues.

3 participants