[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.
- ninja
- ./src/bitcoind
- Let it sync for 10000 blocks, Ctrl+C
- ./src/bitcoind -chronik -debug=chronik
- Ctrl+C while Chronik is catching up
- 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