<!-- Describe the issue -->
When synching from blocks already available on disk on startup from a old utxo set, bitcoind become unresponsive during the UpdateTip phase:
2019-07-07T18:46:49Z UpdateTip: new best=00000000000000000028b702b9da76f700cf3da9682553090f485a7281e57922 height=577001 version=0x20000000 log2_work=90.65784 tx=415579661 date='2019-05-21T00:23:35Z' progress=0.964693 cache=1.5MiB(11777txo)
2019-07-07T18:46:53Z UpdateTip: new best=0000000000000000001113e97e93bd818554382f16d089a81371c6873a0b92b6 height=577003 version=0x20000000 log2_work=90.657883 tx=415584870 date='2019-05-21T00:36:11Z' progress=0.964699 cache=4.2MiB(30674txo)
2019-07-07T18:46:54Z UpdateTip: new best=00000000000000000004cc44be2e12e8a8af7d5a70d35a319c0d95fdce3521e6 height=577004 version=0x20000000 log2_work=90.657904 tx=415586975 date='2019-05-21T00:36:35Z' progress=0.964700 cache=5.3MiB(39842txo)
2019-07-07T18:46:56Z UpdateTip: new best=0000000000000000000a7e3b417edb0f5f01d91bdc36d16a9c374917fc647183 height=577005 version=0x20000000 log2_work=90.657926 tx=415589783 date='2019-05-21T00:51:43Z' progress=0.964707 cache=6.3MiB(47978txo)
2019-07-07T18:46:57Z UpdateTip: new best=00000000000000000012bd7a61b374bf4d58f3e780a309df05bbdca40e45d1a5 height=577006 version=0x20000000 log2_work=90.657947 tx=415592867 date='2019-05-21T01:07:04Z' progress=0.964715 cache=7.8MiB(56907txo)
<!--- What behavior did you expect? -->
I expect either it to work or to get an error like it's the case when trying to run a cli command during the "Verifying last 6 blocks at level 3" phase
error code: -28
error message:
Verifying blocks...
<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->
Instead, I get the following timeout when trying to run this command:
bitcoin-cli.exe getbestblockhash
error: Could not connect to the server 127.0.0.1:8332 (error code 0 - "timeout reached")
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
<!--- How reliably can you reproduce the issue, what are the steps to do so? -->
This append every time I tried to run a command against it, either it be gettxoutsetinfo or invalidateblock To reproduce the issue yourself you can <!--- either -->:
- run the following bash script (with a few changes according to your own setup) ❗️ backup your chainstate/blocks folder before or set DATADIR/DATA_PATH variable to a new location ❗️ This script require a bunch of disk space available. What it does is basically download & import a chainstate synched at height = 577000 and around ~8go of blocks up to height 583832
<!--- - or invalidate a good number of blocks yourself (since the bug is during the UpdateTip phase you need to have the time for the cli to timeout), wait for the rewind of the utxo-set to finish, reconsider the block, and then restart the daemon. This should put you in a similar state with a bunch of blocks ready to be loaded from disk. -->
#!/bin/bash
DATADIR_PATH="~/.bitcoin/"
DATADIR=""
# DATADIR="-datadir=$DATADIR_PATH"
BITCOIND_OPTION_NO_NETWORK="-maxconnections=0 -par=-7 -rpcthreads=1 -noconnect -listenonion=0 -disablewallet"
BITCOIND_OPTIONS="$DATADIR"
BITCOIN_CLI="bitcoin-cli"
BITCOIND="bitcoind"
HASH_INVALIDATE="00000000000000000028b702b9da76f700cf3da9682553090f485a7281e57922"
HASH_SERIALIZED_SERVER="7c7acc44bdb316db0a1c26c189a7b5b22be567864cb3e6f72e941fd8892f2f67"
BLOCK_HEIGHT="577000"
BLOCKS_FILE="chain-pruned.tar.gz"
wget https://downloads.bitcoinsocialsync.com/utxo-set/utxo-set-$BLOCK_HEIGHT.tar.gz
wget https://downloads.bitcoinsocialsync.com/blockchain/$BLOCKS_FILE
echo ""$DATADIR_PATH"chainstate directory already exist. Deleting..."
rm -rf "$DATADIR_PATH"chainstate
echo "chainstate deleted."
echo ""$DATADIR_PATH"blocks directory already exist. Deleting..."
rm -rf "$DATADIR_PATH"blocks
echo "blocks deleted."
echo "Extracting utxo-set-$BLOCK_HEIGHT.tar.gz to "$DATADIR_PATH"chainstate..."
tar -zxf utxo-set-$BLOCK_HEIGHT.tar.gz -C "$DATADIR_PATH"
echo "Extracting finished."
echo "Extracting $BLOCKS_FILE to "$DATADIR_PATH"blocks..."
tar -zxf $BLOCKS_FILE -C "$DATADIR_PATH"
echo "Extracting finished."
echo "Launching bitcoind with initial import..."
$BITCOIND $BITCOIND_OPTIONS $BITCOIND_OPTION_NO_NETWORK &> bitcoind.log &
sleep 6m # wait for startup phase to finish
$BITCOIN_CLI invalidateblock $HASH_INVALIDATE
$BITCOIN_CLI gettxoutsetinfo
<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->
Pre-compiled version of Bitcoin Core v0.18.0
<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->
bitcoind/cli are installed on the Windows 10 side on a hard drive but all commands are run through WSL, this setup works fine for everything else but that.
<!-- Any extra information that might be useful in the debugging process. -->
<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->
https://gist.githubusercontent.com/SylTi/7e7801e65f355edba3c460731a740d48/raw/bd81624934c42fb2cc45f0aabca3ca0386a516c7/bitcoind.log if you search for "invalid block" you will see some pretty weird stuff. Like the block height going up, then down, then up again.
This happend when the command I tried to run on the CLI was invalidateblock 00000000000000000028b702b9da76f700cf3da9682553090f485a7281e57922 but it also timeout so it shouldn't have affected the sync? And if it did work while showing me a timeout, why did the sync restart after the block was invalidated?