Provider refusals
write_verifier: Provider declined the request because of a cybersecurity restriction. Experiments remain incomplete; static verification can continue.
3 major findings · 2 minor findings · 5 suggestions
Findings
[major] · Disconnect-only rewind persists inconsistent coinstats state
Invalidating an indexed tip and shutting down without a replacement block can save its locator with the parent's MuHash, preventing restart with coinstatsindex enabled.
Location: src/index/base.cpp:222 (head).
Details and suggested fix
With coinstatsindex synced at tip H, call invalidateblock H without connecting a replacement, then shut down cleanly. The new eager CustomRemove reverts the MuHash to H-1 but leaves m_best_block at H. Shutdown force-flushes the chainstate and drains its callbacks before stopping indexes. The H-1 flush passes IgnoreChainStateFlushed because it is an ancestor of H, but this handler commits GetLocator(H) together with MuHash(H-1). On restart, CoinStatsIndex::CustomInit compares that MuHash with H's retained statistics and rejects the index, so startup fails while the index remains enabled. Recovery requires disabling or rebuilding the optional index. Track the tip represented by subclass state after each successful removal and commit that tip's locator rather than the stale checkpoint. Add a regression that invalidates the tip and restarts without mining or reconsidering a block.
[major] · Snapshot disconnections reach indexes following historical validation
During assumeutxo background validation, a snapshot-chain reorg can make a live historical coinstats or blockfilter index remove unindexed heights and shut down the node on its next validated connection.
Location: src/node/interfaces.cpp:490 (head).
Details and suggested fix
attachChain selects ValidatedChainstate(), but its proxy subscribes to global validation signals. Once the historical index has caught up and registered, a snapshot-chain reorg above the snapshot base reaches blockDisconnected without a role or chainstate check. Unlike connected events, these events are not filtered by role.validated. The disconnected height is absent from the historical index, so CopyHeightIndexToHashIndex fails, m_rewind_error latches, and the next validated historical connection calls FatalErrorf. Restarting clears the flag, but another reorg during background validation can repeat the shutdown. A deliberate remote trigger requires competing proof of work and an operator-loaded snapshot. Carry chainstate identity or role with disconnect notifications and route attachChain events only to the chainstate being followed. Preserve active-snapshot disconnect delivery to wallet handleNotifications subscribers, and test this ordering before snapshot validation completes.
[major] · Lagging sync checkpoint makes the rewind assertion abort
A valid reorg during index catch-up can abort the node when the fork lies above the last published checkpoint, because the rewind check treats that checkpoint as the processed tip.
Location: src/index/base.cpp:121 (head).
Details and suggested fix
During SYNCING, ordinary appends return without updating m_best_block between eligible commits, while SyncChain advances its own cursor. Let the non-null checkpoint be H and the cursor have processed through K. If a reorg forks at F with H < F < K, sync removes the old suffix and delivers a replacement connection whose parent is F. The rewind branch asks for H's ancestor at height F, which cannot exist, so findAncestorByHeight returns false and the enabled assertion aborts. A disconnect-only rollback also reaches this through the tip marker when F-1 > H. Natural reorgs can trigger the overlap; practical remote targeting of this window is unconfirmed. Keep an exact processed-tip cursor, update it on every successful append and removal, and validate rewind continuity against that cursor. Add a regression with the checkpoint strictly below the fork.
[minor] · Rewinding to genesis dereferences the completion marker's null parent
An index persisted above genesis can crash during restart after an operator rolls the chain back to genesis, because the pending-rewind handler dereferences the genesis marker's null prev_hash.
Location: src/index/base.cpp:119 (head).
Details and suggested fix
SyncChain sends a data-less blockConnected marker when its cursor reaches the tip, including immediately after rewinding to genesis. MakeBlockInfo gives that marker state SYNCING and prev_hash == nullptr, so the SYNCED early return does not handle it. The pending-rewind branch dereferences *block.prev_hash in both the comparison and setBest. For example, persist txindex at height 1 on regtest, invalidate the height-1 block, and restart without a replacement. The stale locator remains above genesis, and the height-zero startup path does not reject synchronization. Handle the data-less completion marker separately from a real connection, finishing a rewind at the marker block itself rather than its parent.
[minor] · Queued sync-completion callback can outlive Stop() in index tests
The new queued RegisterSynced callback can still access a stack index after Stop() returns in index_reorg_crash, because its queue barrier can run before the sync thread enqueues completion.
Location: src/node/interfaces.cpp:619 (head).
Details and suggested fix
index_reorg_crash waits for GetSummary() to report the final height, then calls StopIndex, which drains the validation queue before calling Stop. The sync thread publishes that height before enqueueing RegisterSynced, so the barrier need not cover the completion callback. If that callback passes connect() before teardown disconnects the proxy, it releases the proxy mutex and can continue accessing BaseIndex while Stop() returns and the stack index is destroyed. Unregistration is nonblocking, and handler destruction joins only the sync thread, contrary to the wait promised by the Stop() comment. No production destruction path with the scheduler still running was identified; normal shutdown stops it and drains callbacks first. Give attach-chain callbacks an in-flight completion guarantee and wait after unregistering and joining, without holding the index mutex or cs_main.
Optional improvements
[suggestion] · Null flush point permits commits despite the documented durability guard
A null last-flushed block now permits periodic sync commits that the base rejected, while Commit's documentation still promises an internal flush-boundary check.
Location: src/node/chain.cpp:40 (head).
Details and suggested fix
If SyncChain processes a nonempty chain with GetLastFlushedBlock() == nullptr, MakeBlockInfo labels every block FLUSHED, allowing the 30-second commit path. The base explicitly rejected commits in this state. Commit() now checks only whether the supplied locator is non-null, so durability is a caller obligation, but its header still promises the removed guard. No current production caller reaching this null-flush sync state was found, and resulting corruption was not established. Treat a null flush point as UNFLUSHED and document that callers must supply a locator matching the current index state and at or behind the durable chainstate.
[suggestion] · Ignored snapshot connections still trigger undo reads
Live historical indexes read undo data for snapshot-chain blocks they will discard, and an undo-read failure shuts down the node before the role filter runs.
Location: src/node/interfaces.cpp:487 (head).
Details and suggested fix
While assumeutxo background validation is active and the historical index subscription is live, NotificationsProxy::BlockConnected reads undo data for every connected snapshot-chain block requested by coinstatsindex or blockfilterindex. Only afterward does IgnoreBlockConnected reject role.validated == false. This adds a discarded undo read per undo-using index on the validation callback thread. A failed read is also handled by FatalErrorf before the role rejection. The base filtered the role before reading. Add an opt-in role filter for index attachChain subscriptions in the proxy and apply it before reading undo data. Keep handleNotifications subscribers receiving current snapshot-chain events.
[suggestion] · Filter range lookup takes cs_main once per ancestor
A successful 2,000-block getcfheaders range lookup now makes 1,999 separately locked Chain calls, which would also become 1,999 round trips if this interface is used across processes.
Location: src/index/blockfilterindex.cpp:354 (head).
Details and suggested fix
The previous pprev walk needed no per-height interface calls. This loop calls findAncestorByHeight for every height below stop, and each call takes cs_main and performs a hash-map lookup, even when all height-index hashes match. The in-process overhead is unmeasured and requests are bounded, but the API shape also creates a per-height round-trip cost for the planned out-of-process index use. Add a batched Chain method returning ancestor hashes for the requested range under one lock. Root it at the supplied stop hash so it returns the same ancestry for stale branches rather than substituting the current active chain.
[suggestion] · Historical log matches skip index-interruption coverage
An earlier process's index-thread message can satisfy a later interruption iteration, letting the test pass after killing the new process before index initialization.
Location: test/functional/feature_init.py:119 (head).
Details and suggested fix
For index-thread stages, the wait searches from log_start_byte, captured before the entire restart loop. Once an earlier startup has logged that stage, the helper can return immediately after the current node.start, which only launches the process. sigterm_node then accepts exit codes that include termination before the signal handler exists. That iteration no longer demonstrates interruption of index sync or handler teardown; the final successful restart checks recovery but does not restore this coverage. The missing-thread-message race is real because synced indexes no longer start a thread. Ensure each index-stage iteration has pending synchronization work, for example by removing that index's data while stopped, and match only the current process's log.
[suggestion] · Block-filter benchmark repeats teardown inside each measurement
The added Interrupt() and Stop() calls duplicate the retained StopIndex() teardown, adding unnecessary work to every measured benchmark iteration.
Location: src/bench/index_blockfilter.cpp:56 (head).
Details and suggested fix
This benchmark creates a wiped index behind the existing chain, and SyncOnce() synchronizes it in the foreground without starting a handler thread or registering for live notifications. The final StopIndex() already drains the validation queue and calls Stop(), which calls Interrupt() itself. GetSummary() does not require the index to be stopped first. Remove the explicit Interrupt() and Stop() immediately after SyncOnce() and keep the final StopIndex() as the single teardown.