From 8ae22808016a4a7127fcebc684b79ec0b670ae38 Mon Sep 17 00:00:00 2001 From: pasta Date: Tue, 19 Aug 2025 18:46:13 -0500 Subject: [PATCH 01/19] feat: add special transaction support to compact block filters (BIP-157/158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements extraction of special transaction fields for compact block filters, achieving feature parity with bloom filters. SPV clients can now detect special transactions using either filtering mechanism. Changes: - Add ExtractSpecialTxFilterElements() to extract fields from special txs - Integrate special tx extraction into BasicFilterElements() - Support all special transaction types: * ProRegTx: collateral, owner/voting keys, payout script * ProUpServTx: ProTx hash, operator payout * ProUpRegTx: ProTx hash, voting key, payout script * ProUpRevTx: ProTx hash * AssetLockTx: credit output scripts - Add comprehensive unit tests for all transaction types - Add functional tests with actual AssetLockTx transactions - Use delegation pattern to avoid circular dependencies The implementation mirrors CheckSpecialTransactionMatchesAndUpdate() to ensure consistent behavior between bloom and compact filters. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/Makefile.am | 2 + src/blockfilter.cpp | 6 + src/evo/specialtx_filter.cpp | 134 ++++++++++++++ src/evo/specialtx_filter.h | 24 +++ src/test/blockfilter_tests.cpp | 252 +++++++++++++++++++++++++ test/functional/p2p_blockfilters.py | 273 +++++++++++++++++++++++++++- 6 files changed, 690 insertions(+), 1 deletion(-) create mode 100644 src/evo/specialtx_filter.cpp create mode 100644 src/evo/specialtx_filter.h diff --git a/src/Makefile.am b/src/Makefile.am index 18c318829dc59..45c98edb9a8f8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -200,6 +200,7 @@ BITCOIN_CORE_H = \ evo/simplifiedmns.h \ evo/smldiff.h \ evo/specialtx.h \ + evo/specialtx_filter.h \ evo/specialtxman.h \ dsnotificationinterface.h \ governance/governance.h \ @@ -479,6 +480,7 @@ libbitcoin_node_a_SOURCES = \ evo/simplifiedmns.cpp \ evo/smldiff.cpp \ evo/specialtx.cpp \ + evo/specialtx_filter.cpp \ evo/specialtxman.cpp \ flatfile.cpp \ governance/classes.cpp \ diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index e58c4c2110ed9..9e82b7d654d01 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include