Page MenuHomePhabricator

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

Authored by tobias_ruck on May 27 2023, 08:48.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCdd69c97ca0ba: [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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable