Skip to content

Parallel Silent Payment index #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: 2025/04/bip352-index
Choose a base branch
from

Conversation

Sjors
Copy link
Owner

@Sjors Sjors commented Jul 17, 2025

Based on:

Usage

build/bin/bitcoin node -bip352index -indexworkers=10

Caveats:

@Sjors Sjors marked this pull request as draft July 17, 2025 08:48
@Sjors Sjors force-pushed the 2025/04/bip352-index branch from 3e4eb1e to 9f441e8 Compare July 24, 2025 13:23
@Sjors Sjors force-pushed the 2025/07/bip352-index-turbo branch from 5f23fa1 to a5fe4b9 Compare July 24, 2025 13:39
@Sjors
Copy link
Owner Author

Sjors commented Jul 24, 2025

@furszy I rebased on the latest #86 and the latest commits from bitcoin#26966. I then used b8883fa from your branch. But it still segfaults. Maybe I missed something?

2025-07-25T12:40:51.364698Z txindex thread start
2025-07-25T12:40:51.364730Z txindex thread exit
2025-07-25T12:40:51.364773Z threadpool_worker_0 thread start
2025-07-25T12:40:51.364823Z bip352 index thread start
zsh: segmentation fault  build/bin/bitcoin node -nowallet -bip352index -indexworkers=1

@Sjors Sjors force-pushed the 2025/04/bip352-index branch from 9f441e8 to cdf7de3 Compare July 25, 2025 12:31
furszy added 5 commits July 25, 2025 14:36
And add option to customize thread pool workers count
Conflicts:
- src/index/base.cpp

Resolved by passing m_start_height to NextSyncBlock.
It also adds coverage for initial sync from a particular block.
Mimicking a node restart.
@Sjors Sjors force-pushed the 2025/07/bip352-index-turbo branch from a5fe4b9 to 0e75edb Compare July 25, 2025 12:37
@furszy
Copy link

furszy commented Jul 25, 2025

@furszy I rebased on the latest #86 and the latest commits from bitcoin#26966. I then used b8883fa from your branch. But it still segfaults. Maybe I missed something?

It fails due to the custom start_height you have in this branch (1fb0a3c). During the rebase, dropped:

diff --git a/src/index/base.cpp b/src/index/base.cpp
--- a/src/index/base.cpp	(revision 0e75edb4e2c1242f541c6208cdf22d411cf22d7a)
+++ b/src/index/base.cpp	(date 1753454368355)
@@ -263,6 +263,13 @@
         return;
     }
 
+    // If pindex_next is our first block and we are starting from a custom height,
+    // set pindex to be the previous block. This ensures we test that we can still rewind
+    // from our custom start height in the event of a reorg.
+    if (pindex_next->nHeight == m_start_height && m_start_height > 0) {
+        pindex = pindex_next->pprev;
+    }
+
     // Handle potential reorgs; if the next block's parent doesn't match our current tip,
     // rewind our index state to match the chain and resume from there.
     if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {

That being said, 1fb0a3c code seems a bit flaky during startup (what if the index receives a block through the validation events - it seems it will still try to connect it even when it is below the start_height) but will not review something is not meant to get merged in Core :).

@Sjors
Copy link
Owner Author

Sjors commented Jul 25, 2025

@furszy thanks. It doesn't need to be very robust, I'm just trying to measure the performance difference. And for the base index PR it's mainly about checking the SP crypto matches other implementations.

I think the way to really add new indexes, e.g. to help lite clients, is to have an IPC interface for external indexers.

@furszy
Copy link

furszy commented Jul 25, 2025

I think the way to really add new indexes, e.g. to help lite clients, is to have an IPC interface for external indexers.

yeah, that's where bitcoin#24230 is heading to.

@Sjors Sjors force-pushed the 2025/07/bip352-index-turbo branch from 7c42695 to 5a7ac49 Compare July 25, 2025 16:36
furszy and others added 2 commits July 25, 2025 18:45
This was dropped while dealing with merge conflict in "implement index parallel sync".
@Sjors Sjors force-pushed the 2025/07/bip352-index-turbo branch from 5a7ac49 to 2a2bc0b Compare July 25, 2025 16:45
@Sjors
Copy link
Owner Author

Sjors commented Jul 25, 2025

I noticed a huge amount of disk reading on my spinning disk and it taking a long time before index actually started building. Added an early return to aseIndex::ProcessBlocks.

Despite the change it still spends 7 minutes rattling the disk before finally showing a "Syncing bip352 index with ..." log message. But it just continues the heavy disk i/o for at least another 10 minutes before I gave up.

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.

2 participants