Skip to content

key-wallet-manager: include watched_outpoints in compact-filter matching (defense-in-depth for #649-class bugs) #855

Description

@lklimek

Summary

Splitting this out of #649 so it survives that issue's closure once PR #851 lands.

#649's own body flagged a secondary, defense-in-depth concern: check_compact_filters_for_addresses (key-wallet-manager/src/matching.rs) queries GCS filters using only output scriptPubKeys, not watched_outpoints(). Per BIP158, the basic filter type also contains each input's prevout scriptPubKey, so this currently works in practice — but relying on that implicitly, rather than also querying watched_outpoints() explicitly (the way the mempool bloom filter already does, dash-spv/src/sync/mempool/filter.rs), leaves no defense-in-depth if filter behavior or type ever changes.

PR #851 fixes #649's primary wallet-side reconciliation bug but does not touch filter matching — this is legitimate scoping, not an oversight, but the concern needs its own tracker so it isn't silently dropped when #649 closes.

Proposed fix

Add watched_outpoints() (serialized appropriately) to the set of items queried against compact filters in check_compact_filters_for_addresses, mirroring the existing mempool bloom filter's approach.

🤖 Co-authored by Claudius the Magnificent AI Agent

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions