lbrycrd/src
Wladimir J. van der Laan bd924241e7
Merge #10758: Fix some chainstate-init-order bugs.
c0025d0 Fix segfault when shutting down before fully loading (Matt Corallo)
1385697 Order chainstate init more logically. (Matt Corallo)
ff3a219 Call RewindBlockIndex even if we're about to run -reindex-chainstate (Matt Corallo)
b0f3249 More user-friendly error message if UTXO DB runs ahead of block DB (Matt Corallo)
eda888e Fix some LoadChainTip-related init-order bugs. (Matt Corallo)

Pull request description:

  This does a number of things to clean up chainstate init order,
  fixing some issues as it goes:

  * Order chainstate init more logically - first all of the
    blocktree-related loading, then coinsdb, then
    pcoinsTip/chainActive. Only create objects as needed.

  * More clearly document exactly what is and isn't called in
    -reindex and -reindex-chainstate both with comments noting
    calls as no-ops and by adding if guards.

  * Move the writing of fTxIndex to LoadBlockIndex - this fixes a
    bug introduced in d6af06d68a where
    InitBlockIndex was writing to fTxIndex which had not yet been
    checked (because LoadChainTip hadn't yet initialized the
    chainActive, which would otherwise have resulted in
    InitBlockIndex being a NOP), allowing you to modify -txindex
    without reindex, potentially corrupting your chainstate!

  * Rename InitBlockIndex to LoadGenesisBlock, which is now a more
    natural name for it. Also check mapBlockIndex instead of
    chainActive, fixing a bug where we'd write the genesis block out
    on every start.

  * Move LoadGenesisBlock further down in init. This is a more logical
    location for it, as it is after all of the blockindex-related
    loading and checking, but before any of the UTXO-related loading
    and checking.

  * Give LoadChainTip a return value - allowing it to indicate that
    the UTXO DB ran ahead of the block DB. This just provides a nicer
    error message instead of the previous mysterious
    assert(!setBlockIndexCandidates.empty()) error.

  * Calls ActivateBestChain in case we just loaded the genesis
    block in LoadChainTip, avoiding relying on the ActivateBestChain
    in ThreadImport before continuing init process.

  * Move all of the VerifyDB()-related stuff into a -reindex +
    -reindex-chainstate if guard. It couldn't do anything useful
    as chainActive.Tip() would be null at this point anyway.

Tree-SHA512: 3c96ee7ed44f4130bee3479a40c5cd99a619fda5e309c26d60b54feab9f6ec60fabab8cf47a049c9cf15e88999b2edb7f16cbe6819e97273560b201a89d90762
2017-08-01 12:58:38 +02:00
..
bench Add SHA256 dispatcher 2017-07-20 09:03:53 -07:00
compat [trivial] Add end of namespace comments 2017-05-31 22:21:25 +02:00
config
consensus Fix typos 2017-07-15 14:28:40 +02:00
crypto Protect SSE4 code behind a compile-time flag 2017-07-20 09:03:53 -07:00
leveldb Fixed multiple typos 2017-06-22 19:18:10 +03:00
obj
obj-test
policy Merge #10862: Remove unused variable int64_t nEnd. Fix typo: "conditon" → "condition". 2017-07-20 16:56:45 +02:00
primitives Replace traditional for with ranged for in primitives 2017-07-24 16:32:21 +02:00
qt qt: Periodic translations update 2017-07-31 12:19:05 +02:00
rpc Fix misleading "Method not found" multiwallet errors 2017-07-26 02:48:15 -04:00
script Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
secp256k1 Fixed multiple typos 2017-06-22 19:18:10 +03:00
support Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
test Merge #10758: Fix some chainstate-init-order bugs. 2017-08-01 12:58:38 +02:00
univalue
wallet Clarify help message for -discardfee 2017-07-28 09:54:59 -04:00
zmq Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
.clang-format Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp> 2017-07-04 18:05:18 +02:00
addrdb.cpp Deduplicate addrdb.cpp and use CHashWriter/Verifier 2017-06-01 16:42:07 -07:00
addrdb.h Deduplicate addrdb.cpp and use CHashWriter/Verifier 2017-06-01 16:42:07 -07:00
addrman.cpp Merge #9792: FastRandomContext improvements and switch to ChaCha20 2017-04-24 14:28:49 +02:00
addrman.h Merge #9792: FastRandomContext improvements and switch to ChaCha20 2017-04-24 14:28:49 +02:00
amount.h Consensus: Policy: MOVEONLY: Move CFeeRate out of the consensus module 2017-05-03 18:00:13 +02:00
arith_uint256.cpp Fix instantiation and array accesses in class base_uint<BITS> 2017-06-07 17:21:29 +00:00
arith_uint256.h Fix instantiation and array accesses in class base_uint<BITS> 2017-06-07 17:21:29 +00:00
base58.cpp Fix subscript[0] in base58.cpp 2017-07-08 13:33:01 -07:00
base58.h Fix subscript[0] in base58.cpp 2017-07-08 13:33:01 -07:00
bitcoin-cli-res.rc
bitcoin-cli.cpp Fix misleading "Method not found" multiwallet errors 2017-07-26 02:48:15 -04:00
bitcoin-tx-res.rc
bitcoin-tx.cpp Remove confusing MAX_BLOCK_BASE_SIZE. 2017-07-14 19:24:17 +00:00
bitcoind-res.rc
bitcoind.cpp init: Factor out AppInitLockDataDirectory 2017-07-17 14:56:52 +02:00
blockencodings.cpp Fix typos 2017-07-15 14:28:40 +02:00
blockencodings.h [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
bloom.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
bloom.h param variables made const 2017-02-13 14:39:48 +09:00
chain.cpp [MOVEONLY] Move LastCommonAncestor to chain 2017-06-26 10:45:48 -07:00
chain.h [MOVEONLY] Move LastCommonAncestor to chain 2017-06-26 10:45:48 -07:00
chainparams.cpp Update defaultAssumeValid according to release-process.md. 2017-07-28 01:11:14 +00:00
chainparams.h chainparams: make supported service bits option explicit 2017-06-22 15:21:22 -04:00
chainparamsbase.cpp Chainparams: Use a regular factory for creating chainparams 2017-05-03 18:15:47 +02:00
chainparamsbase.h Chainparams: Use a regular factory for creating chainparams 2017-05-03 18:15:47 +02:00
chainparamsseeds.h p2p: Hardcoded seeds update pre-0.15 branch 2017-07-30 14:04:51 +02:00
checkpoints.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
checkpoints.h [MOVEONLY] Move progress estimation out of checkpoints 2017-01-04 13:18:49 -08:00
checkqueue.h scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
clientversion.cpp Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
clientversion.h Fix build warning from #error text 2017-04-07 14:37:25 -04:00
coins.cpp Remove confusing MAX_BLOCK_BASE_SIZE. 2017-07-14 19:24:17 +00:00
coins.h Merge #10558: Address nits from per-utxo change 2017-06-28 11:44:22 -07:00
compat.h Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions 2017-07-22 09:11:55 +02:00
compressor.cpp Fix subscript[0] in compressor.cpp 2017-07-08 13:33:01 -07:00
compressor.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
core_io.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
core_memusage.h Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
core_read.cpp Fix signed/unsigned comparison warning introduced in c8e29d7ff0. 2017-07-12 14:03:42 -04:00
core_write.cpp Remove confusing MAX_BLOCK_BASE_SIZE. 2017-07-14 19:24:17 +00:00
cuckoocache.h Merge #10577: Add an explanation of quickly hashing onto a non-power of two range. 2017-06-24 11:28:04 +02:00
dbwrapper.cpp Merge #9544: [trivial] Add end of namespace comments. Improve consistency. 2017-06-26 13:40:26 +02:00
dbwrapper.h Report on-disk size in gettxoutsetinfo 2017-05-26 13:33:39 -07:00
fs.cpp Remove unused Boost includes 2017-06-09 10:25:26 +02:00
fs.h [Trivial] Add BITCOIN_FS_H endif footer in fs.h 2017-05-19 02:01:28 -07:00
hash.cpp Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). 2017-07-08 13:33:01 -07:00
hash.h Add specialization of SipHash for 256 + 32 bit data 2017-05-26 13:24:25 -07:00
httprpc.cpp Register wallet endpoint 2017-07-17 11:56:00 +02:00
httprpc.h Remove unnecessary forward class declarations in header files 2017-06-12 20:37:43 +02:00
httpserver.cpp Add wallet endpoint support to bitcoin-cli (-usewallet) 2017-07-17 17:42:09 +02:00
httpserver.h Add wallet endpoint support to bitcoin-cli (-usewallet) 2017-07-17 17:42:09 +02:00
indirectmap.h
init.cpp Merge #10758: Fix some chainstate-init-order bugs. 2017-08-01 12:58:38 +02:00
init.h init: Factor out AppInitLockDataDirectory 2017-07-17 14:56:52 +02:00
key.cpp Fix subscript[0] potential bugs in key.cpp 2017-07-08 13:37:06 -07:00
key.h Remove unused C++ code not covered by unit tests 2017-04-26 21:20:02 +02:00
keystore.cpp Remove unused Boost includes 2017-06-09 10:25:26 +02:00
keystore.h Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
limitedmap.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
Makefile.am Protect SSE4 code behind a compile-time flag 2017-07-20 09:03:53 -07:00
Makefile.bench.include leveldb: enable runtime-detected crc32 instructions 2017-06-09 19:25:36 -07:00
Makefile.leveldb.include build: verify that the assembler can handle crc32 functions 2017-07-13 12:49:05 -04:00
Makefile.qt.include leveldb: enable runtime-detected crc32 instructions 2017-06-09 19:25:36 -07:00
Makefile.qttest.include leveldb: enable runtime-detected crc32 instructions 2017-06-09 19:25:36 -07:00
Makefile.test.include Fix test_bitcoin circular dependency issue 2017-07-17 17:42:21 +02:00
memusage.h scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
merkleblock.cpp Merge #9980: Fix mem access violation merkleblock 2017-07-17 15:12:39 -07:00
merkleblock.h Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash() 2017-07-12 10:48:37 -05:00
miner.cpp scripted-diff: Fully remove BOOST_FOREACH 2017-06-05 20:10:50 +02:00
miner.h Remove unnecessary forward class declarations in header files 2017-06-12 20:37:43 +02:00
net.cpp Merge #10501: remove some unused functions 2017-07-27 13:19:32 +02:00
net.h remove some unused functions 2017-07-22 09:55:57 +02:00
net_processing.cpp Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp> 2017-07-04 18:05:18 +02:00
net_processing.h Add timeout for headers sync 2017-06-05 16:33:35 -04:00
netaddress.cpp remove some unused functions 2017-07-22 09:55:57 +02:00
netaddress.h remove some unused functions 2017-07-22 09:55:57 +02:00
netbase.cpp Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions 2017-07-22 09:11:55 +02:00
netbase.h Move CloseSocket out of SetSocketNonBlocking and pass SOCKET by const reference in SetSocket* functions 2017-07-22 09:11:55 +02:00
netmessagemaker.h Net: Make CNetMsgMaker more const 2017-01-31 23:29:28 +01:00
noui.cpp Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
noui.h
pow.cpp pow: GetNextWorkRequired never called with NULL pindexLast 2017-02-15 22:11:29 +09:00
pow.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
prevector.h Explicitly initialize prevector::_union to avoid new warning 2017-07-14 20:52:38 -04:00
protocol.cpp Merge #9544: [trivial] Add end of namespace comments. Improve consistency. 2017-06-26 13:40:26 +02:00
protocol.h Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. 2017-07-16 21:22:05 +02:00
pubkey.cpp Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check 2017-07-08 13:31:47 -07:00
pubkey.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
random.cpp random: only use getentropy on openbsd 2017-07-17 13:14:53 -04:00
random.h Merge #10377: Use rdrand as entropy source on supported platforms 2017-06-14 15:22:15 +02:00
rest.cpp Fixed multiple typos 2017-06-22 19:18:10 +03:00
reverse_iterator.h Introduce src/reverse_iterator.hpp and include it... 2017-06-22 03:48:42 +02:00
reverselock.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
scheduler.cpp Add missing lock in CScheduler::AreThreadsServicingQueue() 2017-07-23 14:51:22 -04:00
scheduler.h Expose if CScheduler is being serviced, assert its not in EmptyQueue 2017-07-10 21:08:19 -04:00
serialize.h Fix subscript[0] in validation.cpp 2017-07-08 13:33:01 -07:00
streams.h Fix subscript[0] in streams.h 2017-07-08 13:33:01 -07:00
sync.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
sync.h Remove unused Boost includes 2017-06-09 10:25:26 +02:00
threadinterrupt.cpp net: add CThreadInterrupt and InterruptibleSleep 2017-01-03 17:53:09 -05:00
threadinterrupt.h net: add CThreadInterrupt and InterruptibleSleep 2017-01-03 17:53:09 -05:00
threadsafety.h
timedata.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2017-06-22 03:48:52 +02:00
timedata.h Merge #8808: Do not shadow variables (gcc set) 2017-03-03 15:48:53 +01:00
tinyformat.h util: Throw tinyformat::format_error on formatting error 2017-03-13 06:51:15 +01:00
torcontrol.cpp Fix subscript[0] in torcontrol 2017-07-08 13:33:01 -07:00
torcontrol.h
txdb.cpp Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
txdb.h Merge #10148: Use non-atomic flushing with block replay 2017-06-28 18:26:41 +02:00
txmempool.cpp Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp> 2017-07-04 18:05:18 +02:00
txmempool.h Merge #10685: Clarify CCoinsViewMemPool documentation. 2017-06-28 11:22:00 -07:00
ui_interface.cpp
ui_interface.h [Qt] allow to execute a callback during splashscreen progress 2017-06-29 17:48:08 +02:00
uint256.cpp uint256: replace sprintf with HexStr and reverse-iterator 2017-02-27 10:02:45 +01:00
uint256.h Increment MIT Licence copyright header year on files modified in 2016 2016-12-31 11:01:21 -07:00
undo.h Remove confusing MAX_BLOCK_BASE_SIZE. 2017-07-14 19:24:17 +00:00
util.cpp Merge #10118: Util: Remove redundant calls to argsGlobal.IsArgSet() 2017-06-27 16:29:11 +02:00
util.h Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. 2017-07-16 21:22:05 +02:00
utilmoneystr.cpp Refactor: Remove using namespace <xxx> from util* 2017-03-08 08:47:02 -08:00
utilmoneystr.h
utilstrencodings.cpp Merge #10812: [utils] Allow bitcoin-cli's -rpcconnect option to be used with square brackets 2017-07-15 13:26:49 -07:00
utilstrencodings.h [refactor] move SplitHostPort() into utilstrencodings 2017-07-12 17:06:15 -04:00
utiltime.cpp [logging] log system time and mock time 2017-05-10 15:49:00 -04:00
utiltime.h [logging] log system time and mock time 2017-05-10 15:49:00 -04:00
validation.cpp Merge #10758: Fix some chainstate-init-order bugs. 2017-08-01 12:58:38 +02:00
validation.h Merge #10758: Fix some chainstate-init-order bugs. 2017-08-01 12:58:38 +02:00
validationinterface.cpp Flush CValidationInterface callbacks prior to destruction 2017-07-07 12:55:57 -04:00
validationinterface.h Remove declaration of unused function: void UpdatedTransaction(const uint256 &) 2017-07-15 20:04:04 +02:00
version.h Remove unused constant MEMPOOL_GD_VERSION 2017-06-09 01:45:36 +02:00
versionbits.cpp Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
versionbits.h scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ 2017-05-30 19:21:52 +02:00
warnings.cpp remove some unused functions 2017-07-22 09:55:57 +02:00
warnings.h remove some unused functions 2017-07-22 09:55:57 +02:00