Page MenuHomePhabricator

restart chronik when reaching the assumeutxo base block
AcceptedPublic

Authored by PiRK on Thu, May 8, 09:02.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

This restarts chronik the same as other indexers when reaching the snapshot base.

Part of the work to support Chronik with assume was done in D17894:

  • not indexing blocks that have ChainstateRole::ASSUMEDVALID (blocks arriving on the m_snapshot_chainstate while the backroung IBD is still ongoing)
  • selecting the proper chainstate based on the current state
    • m_ibd_chainstate when an active background IBD is happening
    • m_snapshot_chainstate after the background IBD is complete
    • m_ibd_chainstate after a restart when this is the only chainstate left

Add basic tests for chronik when loading a utxo snapshot..

Test Plan

ninja all chek-all

Diff Detail

Event Timeline

PiRK requested review of this revision.Thu, May 8, 09:02

Tail of the build log:

Build 'Bitcoin ABC Diffs / Diff Testing' #N/A, branch 'refs/tags/phabricator/diff/53900'
Triggered 2025-05-08 09:02:41 by 'Phabricator Staging (phabricator-staging)'
Started 2025-05-08 09:02:52 on agent 'N/A'
Finished 2025-05-08 09:02:52 with status FAILURE 'Snapshot dependency failed to start: Automated Deployments / Bitcoin ABC Infra / Bitcoin-ABC Infra Checkout'
VCS revisions: 'BitcoinABC_BitcoinAbcStaging' (Git, instance id 22): 'b8cb400ffade1f736caf90b20a4fe81a038e963e' (branch: 'refs/tags/phabricator/diff/53900', checkout rules: '+:. => ./bitcoin-abc')
TeamCity URL https://build.bitcoinabc.org/buildConfiguration/BitcoinABC_BitcoinAbcStaging/937734 
TeamCity server version is 2025.03.1 (build 186125), server timezone: GMT (UTC)

[09:02:41]W: bt15 (11s)
[09:02:41]i: TeamCity server version is 2025.03.1 (build 186125)
[09:02:41] : Finalize build settings
[09:02:41] : Collecting changes in 2 VCS roots
[09:02:41] :	 [Collecting changes in 2 VCS roots] VCS Root details
[09:02:41] :		 [VCS Root details] "Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}
[09:02:41] :		 [VCS Root details] "abc-infrastructure" {instance id=24, parent internal id=7, parent id=AutomatedDeployments_BitcoinAbcDeveloperTools_AbcInfrastructure, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/infrastructure.git#refs/heads/master"}
[09:02:41]i: Loading current repository state for VCS root 'Bitcoin ABC Staging' (7s)
[09:02:41]i:	 [Loading current repository state for VCS root 'Bitcoin ABC Staging'] VCS root 'Bitcoin ABC Staging': git -c credential.helper= -c credential.helper=/opt/teamcity/temp/credHelper16104050318573218097.sh ls-remote origin
[09:02:41]i:	 [Loading current repository state for VCS root 'Bitcoin ABC Staging'] Loading current repository state for VCS root 'abc-infrastructure' (7s)
[09:02:41]i:		 [Loading current repository state for VCS root 'abc-infrastructure'] VCS root 'abc-infrastructure': git -c credential.helper= -c credential.helper=/opt/teamcity/temp/credHelper6603750903654592360.sh ls-remote origin
[09:02:41]i:		 [Loading current repository state for VCS root 'abc-infrastructure'] VCS root 'Bitcoin ABC Staging': Warning: Permanently added '[reviews.bitcoinabc.org]:2221' (ED25519) to the list of known hosts.
[09:02:41]i:		 [Loading current repository state for VCS root 'abc-infrastructure'] VCS root 'abc-infrastructure': Warning: Permanently added '[reviews.bitcoinabc.org]:2221' (ED25519) to the list of known hosts.
[09:02:42]i: Detecting changes in VCS root 'abc-infrastructure' (used in 'Bitcoin-ABC Infra Checkout', 'Extract Electrum ABC from ABC' and 5 other configurations)
[09:02:42]i: Will collect changes for 'abc-infrastructure' starting from revision 5e6327d9db2fe80fcde14ce0e75c8e81f110202e
[09:02:42]i: Waiting for completion of current operations for the VCS root 'Bitcoin ABC Staging'
[09:02:48]i: Detecting changes in VCS root 'Bitcoin ABC Staging' (used in 'Diff Testing', 'Staging Checkout Dummy')
[09:02:48]i: Will collect changes for 'Bitcoin ABC Staging' starting from revision c5564148fabb5befc9627634f3aec7ca82082f22
[09:02:48] : Compute revision for 'Bitcoin ABC Staging'
[09:02:48] :	 [Compute revision for 'Bitcoin ABC Staging'] Upper limit revision: b8cb400ffade1f736caf90b20a4fe81a038e963e
[09:02:48]i:	 [Compute revision for 'Bitcoin ABC Staging'] MaxModId = 81293
[09:02:48] : Compute revision for 'abc-infrastructure' in Automated Deployments / Bitcoin ABC Infra / Bitcoin-ABC Infra Checkout
[09:02:48] :	 [Compute revision for 'abc-infrastructure' in Automated Deployments / Bitcoin ABC Infra / Bitcoin-ABC Infra Checkout] Upper limit revision: 5e6327d9db2fe80fcde14ce0e75c8e81f110202e
[09:02:48]i:	 [Compute revision for 'abc-infrastructure' in Automated Deployments / Bitcoin ABC Infra / Bitcoin-ABC Infra Checkout] MaxModId = 78845
[09:02:48] :	 [Compute revision for 'Bitcoin ABC Staging'] Computed revision: b8cb400ffade1f736caf90b20a4fe81a038e963e
[09:02:48] :	 [Compute revision for 'abc-infrastructure' in Automated Deployments / Bitcoin ABC Infra / Bitcoin-ABC Infra Checkout] Computed revision: 5e6327d9db2fe80fcde14ce0e75c8e81f110202e
[09:02:52]W: Build was removed from the queue with comment: This build has not been started because some of the builds it depends on failed to start
Fabien added a subscriber: Fabien.

We should document this behavior somehow

This revision is now accepted and ready to land.Thu, May 8, 11:47
PiRK retitled this revision from test chronik with assumeutxo to restart chronik when reaching the assumeutxo base block.
PiRK edited the summary of this revision. (Show Details)
PiRK edited the test plan for this revision. (Show Details)

fully support chronik (in the long run this is less work than repeatedly explaining that chronik should be enabled with a restart only after background validation is complete)

Tail of the build log:

[397/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[398/583] Linking CXX executable src/bitcoin-cli
[399/583] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[400/583] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[401/583] Linking C executable src/secp256k1/internal-bench
[402/583] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[403/583] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[404/583] Linking C executable src/secp256k1/ecmult-bench
[405/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[406/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[407/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[408/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[409/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[410/583] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[411/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[412/583] Linking CXX executable src/bitcoin-tx
[413/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[414/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[415/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[416/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[417/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[418/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[419/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[420/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[421/583] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[422/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[423/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[424/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[425/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[426/583] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[427/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[428/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[429/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[430/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[431/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[432/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[433/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[434/583] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[435/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[436/583] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[437/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[438/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[439/583] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[440/583] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[441/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[442/583] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[443/583] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[444/583] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[445/583] Linking CXX executable src/iguana/iguana
[446/583] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[447/583] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[448/583] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[449/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[450/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[451/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[452/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[453/583] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[454/583] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[396/581] Linking CXX executable src/bitcoin-tx
[397/581] Building CXX object src/CMakeFiles/bitcoind.dir/bitcoind.cpp.o
[398/581] Building CXX object src/CMakeFiles/server.dir/rpc/misc.cpp.o
[399/581] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[400/581] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[401/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[402/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[403/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[404/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[405/581] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[406/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[407/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[408/581] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[409/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[410/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[411/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[412/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[413/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[414/581] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[415/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[416/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[417/581] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[418/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[419/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[420/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[421/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[422/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[423/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[424/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[425/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[426/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[427/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[428/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[429/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[430/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[431/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[432/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[433/581] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[434/581] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[435/581] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[436/581] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[437/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[438/581] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[439/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[440/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[441/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[442/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[443/581] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[444/581] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[445/581] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[446/581] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[447/581] Linking CXX executable src/iguana/iguana
[448/581] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[449/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[450/581] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[451/581] Linking CXX static library src/wallet/libwallet.a
[452/581] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[453/581] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
PiRK planned changes to this revision.Fri, May 9, 14:04

will likely have to wrap the lambda captures in #if ENABLE_CHRONIK blocks to prevent error: lambda capture 'args' is not used [-Werror,-Wunused-lambda-capture]

fix clang-tidy warning

This revision is now accepted and ready to land.Fri, May 9, 14:07
Fabien requested changes to this revision.Fri, May 9, 14:44
Fabien added inline comments.
src/init.cpp
2516 ↗(On Diff #53922)

if maybe_unused doesn't work here (idk), then this is one case where the og (void)args; and (void)config; are better than a conditional compilation

test/functional/chronik_assumeutxo.py
105 ↗(On Diff #53922)

please bump the timeout here. Default is 2s which might be short for this logs to pop up

This revision now requires changes to proceed.Fri, May 9, 14:44
test/functional/chronik_assumeutxo.py
105 ↗(On Diff #53922)

The default timeout is 60s for wait_for_debug_log

don't use conditional compilation for lambda definition

Fabien requested changes to this revision.Fri, May 9, 15:39
Fabien added inline comments.
src/init.cpp
2536 ↗(On Diff #53923)

here you can move this code in an #else branch since it's only useful in this case

test/functional/chronik_assumeutxo.py
105 ↗(On Diff #53922)

ah right it's wait not assert

This revision now requires changes to proceed.Fri, May 9, 15:39

move dummy code to #else branch

This revision is now accepted and ready to land.Fri, May 9, 19:15