aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge AuxPoW support from NamecoreRoss Nicoll2019-07-131-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes are as below: Wrap CBlockHeader::nVersion into a new class (CBlockVersion). This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID. Update getauxblock.py for new 'generate' RPC call. Add 'auxpow' to block JSON. Accept auxpow as PoW verification. Add unit tests for auxpow verification. Add check for memory-layout of CBlockVersion. Weaken auxpow chain ID checks for the testnet. Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks. Use this to disable the checks on testnet. Introduce CPureBlockHeader. Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two. Differentiate between uint256 and arith_uint256. This change was done upstream, modify the auxpow code. Add missing lock in auxpow_tests. Fix REST header check for auxpow headers. Those can be longer, thus take that into account. Also perform the check actually on an auxpow header. Correctly set the coinbase for getauxblock results. Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be. (BIP30 block height and COINBASE_FLAGS.) Implement getauxblock plus regression test. Turn auxpow test into FIXTURE test. This allows using of the Params() calls. Move CMerkleTx code to auxpow.cpp. Otherwise we get linker errors when building without wallet. Fix rebase with BIP66. Update the code to handle BIP66's nVersion=3. Enforce that auxpow parent blocks have no auxpow block version. This is for compatibility with namecoind. See also https://github.com/namecoin/namecoin/pull/199. Move auxpow-related parameters to Consensus::Params.
* Scrypt n=1024 PoW hashRoss Nicoll2019-04-031-1/+2
| | | | | | Scrypt n=1024 PoW hash based upon Colin Percival's Tarnsnap (2009) Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher, Ross Nicoll
* Return void instead of bool for functions that cannot failpracticalswift2018-07-271-2/+1
| | | | | | | | | | | | | | | | | * CBlockTreeDB::ReadReindexing(...) * CChainState::ResetBlockFailureFlags(...) * CTxMemPool::addUnchecked(...) * CWallet::LoadDestData(...) * CWallet::LoadKeyMetadata(...) * CWallet::LoadScriptMetadata(...) * CWallet::LoadToWallet(...) * CWallet::SetHDChain(...) * CWallet::SetHDSeed(...) * RemoveLocal(...) * SetMinVersion(...) * StartHTTPServer(...) * StartRPC(...) * TorControlConnection::Disconnect(...)
* scripted-diff: Remove trailing whitespacesJoão Barbosa2018-07-241-1/+1
| | | | | | | | -BEGIN VERIFY SCRIPT- sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue') -END VERIFY SCRIPT-
* Break circular dependency: init -> * -> init by extracting shutdown.hBen Woosley2018-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Most includers just wanted to react to pending shutdown. This isolates access to `fRequestShutdown` and limits access to the shutdown api functions, including the new `AbortShutdown` for setting it to `false`. Note I originally called `AbortShutdown` `CancelShutdown` but that name was already taken by winuser.h https://travis-ci.org/bitcoin/bitcoin/jobs/386913329 This change also triggered a build error in bench. Fixing it required moving LIBBITCOIN_SERVER after LIBBITCOIN_WALLET in bench_bench_bitcoin_LDADD To make server definitions in src/net.cpp available to wallet methods in src/wallet/wallet.cpp. Specifically, solving: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWalletTx::RelayWalletTransaction(CConnman*)': wallet.cpp:(.text+0x3f0e): undefined reference to `CConnman::NodeFullyConnected(CNode const*)' collect2: error: ld returned 1 exit status https://travis-ci.org/bitcoin/bitcoin/jobs/392133581 Need for remaining init.h includes confirmed via a thorough search with a more specific regex: \bInterrupt\(\)|\bShutdown\(\)|\bInitLogging\(\)|\bInitParameterInteraction\(\)|\bAppInitBasicSetup\(\)|\bAppInitParameterInteraction\(\)|\bAppInitSanityChecks\(\)|\bAppInitLockDataDirectory\(\)|\bAppInitMain\(\)|\bSetupServerArgs\(\)|\bLicenseInfo\(\)|g_wallet_init_interface|init.h
* index: Move index DBs into index/ directory.Jim Posen2018-06-041-176/+0
|
* db: Make reusable base class for index databases.Jim Posen2018-06-041-3/+7
|
* db: Remove obsolete methods from CBlockTreeDB.Jim Posen2018-06-041-11/+0
|
* [db] Migration for txindex data to new, separate database.Jim Posen2018-04-251-0/+139
|
* [db] Create separate database for txindex.Jim Posen2018-04-251-0/+32
| | | | | The new TxIndexDB class will be used by a future commit in this change set.
* [logging] Comment all continuing logs.John Newbery2018-04-071-2/+2
| | | | | | | Most logs should terminated with a '\n'. Some logs are built up over multiple calls to logPrintf(), so do not need a newline terminater. Comment all of these 'continued' logs as a linter hing.
* Merge #12653: Allow to optional specify the directory for the blocks storageWladimir J. van der Laan2018-03-271-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a192636 -blocksdir: keep blockindex leveldb database in datadir (Jonas Schnelli) f38e4fd QA: Add -blocksdir test (Jonas Schnelli) 386a6b6 Allow to optional specify the directory for the blocks storage (Jonas Schnelli) Pull request description: Since the actual block files taking up more and more space, it may be desirable to have them stored in a different location then the data directory (use case: SSD for chainstate, etc., HD for blocks). This PR adds a `-blocksdir` option that allows one to keep the blockfiles and the blockindex external from the data directory (instead of creating symlinks). I fist had an option to keep the blockindex within the datadir, but seems to make no sense since accessing the index will (always) lead to access (r/w) the block files. Tree-SHA512: f8b9e1a681679eac25076dc30e45e6e12d4b2d9ac4be907cbea928a75af081dbcb0f1dd3e97169ab975f73d0bd15824c00c2a34638f3b284b39017171fce2409
| * -blocksdir: keep blockindex leveldb database in datadirJonas Schnelli2018-03-201-1/+1
| |
| * Allow to optional specify the directory for the blocks storageJonas Schnelli2018-03-111-1/+1
| |
* | Add static_assert to prevent VARINT(<signed value>)Russell Yanofsky2018-03-151-2/+2
| | | | | | | | | | | | | | | | | | Using VARINT with signed types is dangerous because negative values will appear to serialize correctly, but then deserialize as positive values mod 128. This commit changes the VARINT macro to trigger an error by default if called with an signed value, and updates broken uses of VARINT to pass a special flag that lets them keep working with no change in behavior.
* | Support deserializing into temporariesPieter Wuille2018-03-131-1/+1
|/ | | | | | | | | | | | | | | | Currently, the READWRITE macro cannot be passed any non-const temporaries, as the SerReadWrite function only accepts lvalue references. Deserializing into a temporary is very common, however. See for example things like 's >> VARINT(n)'. The VARINT macro produces a temporary wrapper that holds a reference to n. Fix this by accepting non-const rvalue references instead of lvalue references. We don't propagate the rvalue-ness down, as there are no useful optimizations that only apply to temporaries. Then use this new functionality to get rid of many (but not all) uses of the 'REF' macro (which casts away constness).
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* Merge #10770: Drop upgrade-cancel callback registration for a generic ↵Jonas Schnelli2017-09-071-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | "cancelable" ee4d1493e Drop upgrade-cancel callback registration for a generic "resumeable" (Matt Corallo) Pull request description: Instead of passing a StartShutdown reference all the way up from txdb, give ShowProgress a "cancelable" boolean, as StartShutdown is pretty much always what you'll want to use to cancel. Use the same boolean to allow cancel during initial block verification. Tree-SHA512: 515817aaa4b9e3e856200e00be9c2d44ecfa2d4f288fe3e02116105fe85de2650c13076ee7e45396ec1ce6ab45e53b0477cddda7cfdee5b3bd0589cb81a4c346
| * Drop upgrade-cancel callback registration for a generic "resumeable"Matt Corallo2017-08-201-3/+3
| | | | | | | | | | | | | | Instead of passing a StartShutdown reference all the way up from txdb, give ShowProgress a "resumeable" boolean, which is used to inform the user if the action will be resumed, but cancel is always allowed by just calling StartShutdown().
* | Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-1/+1
|/ | | | In order to avoid unintended implicit conversions.
* scripted-diff: stop using the gArgs wrappersMarko Bencun2017-08-141-2/+2
| | | | | | | | They were temporary additions to ease the transition. -BEGIN VERIFY SCRIPT- find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g' -END VERIFY SCRIPT-
* Skip remainder of init if upgrade is cancelledMatt Corallo2017-08-071-1/+1
|
* Force on-the-fly compaction during pertxout upgradePieter Wuille2017-07-271-1/+5
|
* Avoid dereference-of-casted-pointerPieter Wuille2017-07-071-1/+1
|
* Report [CANCELLED] instead of [DONE] when shut down during txdb upgradeJonas Schnelli2017-06-291-1/+1
|
* Report txdb upgrade not more often then every 10%Jonas Schnelli2017-06-291-2/+8
|
* Show txdb upgrade progress in debug logJonas Schnelli2017-06-291-1/+4
|
* Allow to cancel the txdb upgrade via splashscreen callbackJonas Schnelli2017-06-291-0/+9
|
* Allow to shut down during txdb upgradeJonas Schnelli2017-06-291-0/+3
|
* [qa] Test non-atomic chainstate writesSuhas Daftuar2017-06-261-1/+1
| | | | | | | | | | | | | | | | | Adds new functional test, dbcrash.py, which uses -dbcrashratio to exercise the logic for recovering from a crash during chainstate flush. dbcrash.py is added to the extended tests, as it may take ~10 minutes to run Use _Exit() instead of exit() for crash simulation This eliminates stderr output such as: terminate called without an active exception or Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104. Eliminating the stderr output on crash simulation allows testing with test_runner.py, which reports a test as failed if stderr is produced.
* Dont create pcoinsTip until after ReplayBlocks.Matt Corallo2017-06-261-7/+1
| | | | | | | | | | This requires that we not access pcoinsTip in InitBlockIndex's FlushStateToDisk (so we just skip it until later in AppInitMain) and the LoadChainTip in LoadBlockIndex (which there is already one later in AppinitMain, after ReplayBlocks, so skipping it there is fine). Includes some simplifications by Suhas Daftuar and Pieter Wuille.
* Random db flush crash simulatorPieter Wuille2017-06-261-1/+10
|
* Non-atomic flushing using the blockchain as replay journalPieter Wuille2017-06-261-2/+46
|
* Merge #9176: Globals: Pass Consensus::Params through ↵Wladimir J. van der Laan2017-06-251-4/+4
|\ | | | | | | | | | | | | | | CBlockTreeDB::LoadBlockIndexGuts() b324b28 Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts() (Jorge Timón) Tree-SHA512: 9ef561a026960dc69df52603f4d60246c913bdd127465e8238f0954c6bbbc6b8b3b039bab70df38be1cbf5d06788fb631a2236b49c0167633d54366103c7c055
| * Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()Jorge Timón2017-05-181-4/+4
| |
* | scripted-diff: various renames for per-utxo consistencyPieter Wuille2017-06-011-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to John Newberry for pointing these out. -BEGIN VERIFY SCRIPT- sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h -END VERIFY SCRIPT-
* | Rename CCoinsCacheEntry::coins to coinPieter Wuille2017-06-011-2/+2
| |
* | [MOVEONLY] Move old CCoins class to txdb.cppPieter Wuille2017-06-011-0/+55
| | | | | | | | It's only used for upgrading from the old database anymore.
* | Upgrade from per-tx database to per-txoutPieter Wuille2017-06-011-0/+45
| |
* | Switch CCoinsView and chainstate db from per-txid to per-txoutPieter Wuille2017-06-011-17/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes several related changes: * Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...) to be COutPoint/Coin-based rather than txid/CCoins-based. * Changes the chainstate db to a new incompatible format that is also COutPoint/Coin based. * Implements reconstruction code for hash_serialized_2. * Adapts the coins_tests unit tests (thanks to Russell Yanofsky). A side effect of the new CCoinsView model is that we can no longer use the (unreliable) test for transaction outputs in the UTXO set to determine whether we already have a particular transaction.
* | Report on-disk size in gettxoutsetinfoPieter Wuille2017-05-261-0/+5
| |
* | Fix: make CCoinsViewDbCursor::Seek work for missing keysPieter Wuille2017-05-231-1/+5
|/ | | | Thanks to Suhas Daftuar for figuring this out.
* Replace boost::function with std::function (C++11)practicalswift2017-05-131-1/+1
|
* Change LogAcceptCategory to use uint32_t rather than sets of strings.Gregory Maxwell2017-04-011-1/+1
| | | | | | | | | | | | | | | | | This changes the logging categories to boolean flags instead of strings. This simplifies the acceptance testing by avoiding accessing a scoped static thread local pointer to a thread local set of strings. It eliminates the only use of boost::thread_specific_ptr outside of lockorder debugging. This change allows log entries to be directed to multiple categories and makes it easy to change the logging flags at runtime (e.g. via an RPC, though that isn't done by this commit.) It also eliminates the fDebug global. Configuration of unknown logging categories now produces a warning.
* Refactor: Remove using namespace <xxx> from src/*.cpp.Karl-Johan Alm2017-01-271-12/+10
|
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* C++11: s/boost::scoped_ptr/std::unique_ptr/Jorge Timón2016-09-011-1/+1
|
* Merge #7815: Break circular dependency main ↔ txdbWladimir J. van der Laan2016-05-061-5/+3
|\ | | | | | | 99e7075 Break circular dependency main ↔ txdb (Wladimir J. van der Laan)
| * Break circular dependency main ↔ txdbWladimir J. van der Laan2016-04-151-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Break the circular dependency between main and txdb by: - Moving `CBlockFileInfo` from `main.h` to `chain.h`. I think this makes sense, as the other block-file stuff is there too. - Moving `CDiskTxPos` from `main.h` to `txdb.h`. This type seems specific to txdb. - Pass a functor `insertBlockIndex` to `LoadBlockIndexGuts`. This leaves it up to the caller how to insert block indices.