Node resyncs from 0 following crash
Summary
An unsynced v0.13.3.0 node crashed for no obvious reason (maybe issue 313 related?). Upon restart it started resyncing from 0. Previously it was at height=1363023
Steps to reproduce
Run a v0.13.3.0 node, perhaps the scenario will happen, perhaps it won't.
Expected behavior
A synced or unsynced node should resume operation from where it left off, not randomly resync from 0.
Problematic behavior
Node starts syncing from 0 on restart. I've seen 4 occurrences on 3 different nodes today.
Crown-core environment info
Ubuntu 16.04.6 LTS
Crown-core application info
Crown version v0.13.3.0-3599b03f (2019-05-01 13:40:50 +0400) (build 6072)
Relevant logs, dumps and/or screenshots
2019-05-02 06:52:01 ProcessNewBlock : ACCEPTED
2019-05-02 06:52:01 UpdateTip: new best=609d9fe09909ff6416dee8bbe1270ea89593cb180841300d40e6678b209e4dfb height=1363023 log2_work=75.400136 tx=1453800 date=2017-05-05 13:55:33 progress=0.322039 cache=30.7MiB(96322tx)
2019-05-02 06:52:01 ProcessNewBlock : ACCEPTED
2019-05-02 07:50:06
2019-05-02 07:50:06 Crown version v0.13.3.0-3599b03 (2019-05-01 13:40:50 +0400)
2019-05-02 07:50:06 Using OpenSSL version OpenSSL 1.0.1k 8 Jan 2015
2019-05-02 07:50:06 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2019-05-02 07:50:06 Default data directory /home/crown/.crown
2019-05-02 07:50:06 Using data directory /home/crown/.crown
2019-05-02 07:50:06 Using config file /home/crown/.crown/crown.conf
2019-05-02 07:50:06 Using at most 125 connections (1024 file descriptors available)
2019-05-02 07:50:06 Using 16 threads for script verification
2019-05-02 07:50:06 Binding RPC on address :: port 9341 (IPv4+IPv6 bind any: 1)
2019-05-02 07:50:06 Creating backup of "/home/crown/.crown/wallet.dat" -> "/home/crown/.crown/backups/wallet.dat.2019-05-02-07-50"
2019-05-02 07:50:06 Using wallet wallet.dat
2019-05-02 07:50:06 init message: Verifying wallet...
2019-05-02 07:50:06 CDBEnv::Open: LogDir=/home/crown/.crown/database ErrorFile=/home/crown/.crown/db.log
2019-05-02 07:50:06 Bound to 92.60.44.197:9340
2019-05-02 07:50:06 AddLocal(92.60.44.197:9340,4)
2019-05-02 07:50:06 Cache configuration:
2019-05-02 07:50:06 * Using 37.5MiB for block index database
2019-05-02 07:50:06 * Using 8.0MiB for chain state database
2019-05-02 07:50:06 * Using 254.5MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2019-05-02 07:50:06 init message: Loading block index...
2019-05-02 07:50:06 Opening LevelDB in /home/crown/.crown/blocks/index
2019-05-02 07:50:06 Opened LevelDB successfully
2019-05-02 07:50:06 Opening LevelDB in /home/crown/.crown/chainstate
2019-05-02 07:50:06 Opened LevelDB successfully
2019-05-02 07:50:27 LoadBlockIndexDB: last block file = 18
2019-05-02 07:50:27 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=31752, size=97064497, heights=1159640...1191391, time=2016-12-07...2016-12-30)
2019-05-02 07:50:27 Checking all blk files are present...
2019-05-02 07:50:27 LoadBlockIndexDB(): transaction index enabled
2019-05-02 07:50:27 LoadBlockIndexDB(): hashBestChain=0000000085370d5e122f64f4ab19c68614ff3df78c8d13cb814fd7e69a1dc6da height=0 date=2014-10-08 09:33:46 progress=0.000000
2019-05-02 07:50:27 init message: Verifying blocks...
2019-05-02 07:50:27 block index 21302ms
2019-05-02 07:50:27 init message: Loading wallet...
2019-05-02 07:50:28 nFileVersion = 130300
2019-05-02 07:50:28 Keys: 1002 plaintext, 0 encrypted, 1002 w/ metadata, 1002 total
2019-05-02 07:50:28 wallet 213ms
2019-05-02 07:50:28 UpdateTip: new best=00000000d7ced7fc98a5415486ef5759d7cc8167fe348eae35e78263daa88e18 height=1 log2_work=33.000022 tx=2 date=2014-10-08 16:39:57 progress=0.000000 cache=0.0MiB(1tx)
2019-05-02 07:50:28 UpdateTip: new best=000000002480ebd7bfcf57684751647aac3b182322ca6143bbe0563a73d92532 height=2 log2_work=33.584985 tx=3 date=2014-10-08 16:44:26 progress=0.000000 cache=0.0MiB(2tx)
Drop full logs & dumps here: https://nextcloud.crown.tech/nextcloud/s/znd8HiiAsRX3C6B
Possible fixes
Actually I think it isn't syncing from scratch again; it looks like it's rebuilding the txindex from scratch, but txindex=1 isn't configured and it wasn't started with -txindex.
/cc @artem