Skip to content

Commit c595228

Browse files
furszySjors
authored andcommitted
index: enable bip352 parallel sync
1 parent 42a46c0 commit c595228

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/index/base.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ std::vector<std::any> BaseIndex::ProcessBlocks(bool process_in_order, const CBlo
206206

207207
// If ordering is not required, process blocks directly from end to start
208208
for (const CBlockIndex* block = end; block && start->pprev != block; block = block->pprev) {
209+
if (block->nHeight < m_start_height) continue;
209210
results.emplace_back(ProcessBlock(block));
210211
}
211212

src/index/bip352.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ bool BIP352Index::CustomAppend(const interfaces::BlockInfo& block)
127127
// is needed on non-mainnet chains because m_start_height is 0 by default.
128128
if (block.height == 0) return true;
129129

130-
// Exclude pre-taproot
131-
if (block.height < m_start_height) return true;
132-
133130
tweak_index_entry index_entry;
134131
GetSilentPaymentKeys(Assert(block.data)->vtx, *Assert(block.undo_data), index_entry);
135132

src/index/bip352.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ class BIP352Index final : public BaseIndex
6262

6363
bool CustomAppend(const interfaces::BlockInfo& block) override;
6464

65+
std::any CustomProcessBlock(const interfaces::BlockInfo& block) override {
66+
// Exclude pre-taproot
67+
if (block.height < m_start_height) return true;
68+
69+
return CustomAppend(block);
70+
}
71+
6572
BaseIndex::DB& GetDB() const override;
6673
public:
6774

@@ -70,6 +77,8 @@ class BIP352Index final : public BaseIndex
7077
// Destructor is declared because this class contains a unique_ptr to an incomplete type.
7178
virtual ~BIP352Index() override;
7279

80+
bool AllowParallelSync() override { return true; }
81+
7382
bool FindSilentPayment(const uint256& block_hash, tweak_index_entry& index_entry) const;
7483
};
7584

0 commit comments

Comments
 (0)