HomePhabricator

[Chronik] Stop re-sync if `ShutdownRequested` is true

Description

[Chronik] Stop re-sync if ShutdownRequested is true

Summary:
While rewinding Chronik or while catching up blocks to the node, the user should be able to cancel the process gracefully, using Ctrl+C for example.

We add ffi bindings to ShutdownRequested and check for it in rewind_indexer when rewinding blocks, in resync_indexer when adding blocks, and in try_setup_chronik to short-circuit any further Chronik setup.

Test Plan:
Chronik is way too fast when indexing empty blocks, so a functional test is too difficult/expensive.

  1. ninja
  2. ./src/bitcoind
  3. Let it sync for 10000 blocks, Ctrl+C
  4. ./src/bitcoind -chronik -debug=chronik
  5. Ctrl+C while Chronik is catching up
  6. Chronik re-sync immediately stops, and the node shuts down orderly

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D13945

Details

Provenance
tobias_ruckAuthored on May 27 2023, 08:42
tobias_ruckPushed on May 27 2023, 15:55
Reviewer
Restricted Project
Differential Revision
D13945: [Chronik] Stop re-sync if `ShutdownRequested` is true
Parents
rABC3e0e9af88f7c: build: Remove spaces from variable-printing rules
Branches
Unknown
Tags
Unknown