aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge AuxPoW support from NamecoreRoss Nicoll2018-09-191-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.
* Litecoin: Scrypt n=1024 Pow hash based upon Colin Percival's Tarnsnap (2009) ↵Warren Togami2018-09-191-1/+2
| | | | Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher
* Fix: make CCoinsViewDbCursor::Seek work for missing keysPieter Wuille2017-06-051-1/+5
| | | | | | | Thanks to Suhas Daftuar for figuring this out. Github-Pull: #10445 Rebased-From: 822755a424d0abfa408dc34313f4aca4b816f54f
* 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.
* | dbwrapper: Pass parent CDBWrapper into CDBBatch and CDBIteratorWladimir J. van der Laan2016-04-231-3/+3
| | | | | | | | | | | | | | | | | | Pass parent wrapper directly instead of obfuscation key. This makes it possible for other databases which re-use this code to use other properties from the database. Add a namespace dbwrapper_private for private functions to be used only in dbwrapper.h/cpp and dbwrapper_tests.
* | txdb: Fix assert crash in new UTXO set cursorWladimir J. van der Laan2016-04-181-5/+1
|/ | | | | | | | | Remove the mistaken assumption that GetKey returning false signifies an internal database issue. It will return false when the key cannot be deserialized into the (char,uint256) stanza, which indicates that the cursor has reached a different kind of key. Fixes bug #7890 introduced in #7756.
* txdb: Add Cursor() method to CCoinsView to iterate over UTXO setWladimir J. van der Laan2016-04-151-38/+40
| | | | | | | | | | Add a method Cursor() to CCoinsView that returns a cursor which can be used to iterate over the whole UTXO set. - rpc: Change gettxoutsetinfo to use new Cursor method - txdb: Remove GetStats method - Now that GetStats is implemented in terms of Cursor, remove it.
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* Fix chainstate serialized_size computationPieter Wuille2015-10-281-1/+1
|
* leveldbwrapper symbol rename: Remove "Level" from class, etc. namesJeff Garzik2015-10-221-6/+6
|
* trivial: use constants for db keysDaniel Kraft2015-10-131-4/+4
| | | | | Replace literal occurances of the key "prefixes" 'c' and 'b' in txdb.cpp by the respective constants.
* Refer to obfuscate_key via pointer in peripheral CLevelDB classesJames O'Beirne2015-10-091-3/+3
| | | | cc @sipa
* Handle obfuscation in CLevelDBIteratorJames O'Beirne2015-10-081-3/+3
|
* Encapsulate CLevelDB iterators cleanlyPieter Wuille2015-10-081-39/+20
| | | | | | | Conflicts: src/leveldb.cpp src/leveldb.h src/txdb.cpp
* Add chainstate obfuscation to avoid spurious antivirus detectionJames O'Beirne2015-10-061-17/+10
| | | | | | | | Adds an `obfuscate` parameter to `CLevelDBWrapper` and makes use of it for all new chainstate stores built via `CCoinsViewDB`. Also adds an `Xor` method to `CDataStream`. Thanks to @sipa @laanwj @pstratem @dexX7 @KyrosKrane @gmaxwell.
* TRIVIAL: Missing includesJorge Timón2015-07-231-0/+1
|
* rpc: make `gettxoutsettinfo` run lock-freeWladimir J. van der Laan2015-06-161-1/+4
| | | | | | | For leveldb "An iterator operates on a snapshot of the database taken when the iterator is created". This means that it is unnecessary to lock out other threads while computing statistics, and neither to hold cs_main for the whole time. Let the thread run free.
* Consensus: Refactor: Decouple pow.o from chainparams.oJorge Timón2015-03-261-1/+3
|
* Includes: Do not include main.h from any other headerJorge Timón2015-03-241-0/+1
|
* Remove whitespaces before double colon in errors and logsPavel Janík2015-01-311-3/+3
|
* change hardcoded character constants to a set of descriptive named constants ↵Earlz2015-01-251-21/+32
| | | | for database keys
* Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan2015-01-051-3/+3
| | | | | | Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Merge pull request #5470Wladimir J. van der Laan2014-12-191-1/+1
|\ | | | | | | 78253fc Remove references to X11 licence (Michael Ford)
| * Remove references to X11 licenceMichael Ford2014-12-161-1/+1
| |
* | make all catch() arguments constPhilip Kaufmann2014-12-171-2/+2
|/ | | | | | | - I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase
* Do all block index writes in a batchPieter Wuille2014-11-251-13/+12
|
* MOVEONLY: Separate CTransaction and dependencies from corejtimon2014-10-271-1/+0
|
* rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo`Wladimir J. van der Laan2014-10-211-1/+1
| | | | | | | | | | | This fixes an iterator leak resulting in bitcoind: db/version_set.cc:789: leveldb::VersionSet::~VersionSet(): Assertion `dummy_versions_.next_ == &dummy_versions_' failed." exception on shutdown. Also make sure to flush pcoinsTip before calling GetStats() to make sure we apply them to the current height.
* Merge pull request #4834Pieter Wuille2014-10-081-15/+8
|\ | | | | | | | | | | | | | | 7c70438 Get rid of the dummy CCoinsViewCache constructor arg (Pieter Wuille) ed27e53 Add coins_tests with a large randomized CCoinViewCache test. (Pieter Wuille) 058b08c Do not keep fully spent but unwritten CCoins entries cached. (Pieter Wuille) c9d1a81 Get rid of CCoinsView's SetCoins and SetBestBlock. (Pieter Wuille) f28aec0 Use ModifyCoins instead of mutable GetCoins. (Pieter Wuille)
| * Do not keep fully spent but unwritten CCoins entries cached.Pieter Wuille2014-09-231-3/+8
| | | | | | | | | | | | | | | | | | | | | | Instead of storing CCoins entries directly in CCoinsMap, store a CCoinsCacheEntry which additionally keeps track of whether a particular entry is: * dirty: potentially different from its parent view. * fresh: the parent view is known to not have a non-pruned version. This allows us to skip non-dirty cache entries when pushing batches of changes up, and to remove CCoins entries about transactions that are fully spent before the parent cache learns about them.
| * Get rid of CCoinsView's SetCoins and SetBestBlock.Pieter Wuille2014-09-231-12/+0
| | | | | | | | | | | | All direct modifications are now done through ModifyCoins, and BatchWrite is used for pushing batches of queued modifications up, so we don't need the low-level SetCoins and SetBestBlock anymore in the top-level CCoinsView class.
* | Use a typedef for monetary valuesMark Friedenbach2014-09-261-1/+1
|/
* header include cleanupPhilip Kaufmann2014-09-141-1/+2
| | | | - ensures alphabetical ordering for includes etc. in source file headers
* Merge pull request #4748Pieter Wuille2014-08-261-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | ad49c25 Split up util.cpp/h (Wladimir J. van der Laan) f841aa2 Move `COIN` and `CENT` to core.h (Wladimir J. van der Laan) 6e5fd00 Move `*Version()` functions to version.h/cpp (Wladimir J. van der Laan) b4aa769 Move `S_I*` constants and `MSG_NOSIGNAL` to compat.h (Wladimir J. van der Laan) af8297c Move functions in wallet.h to implementation file (Wladimir J. van der Laan) 651480c move functions in main and net to implementation files (Wladimir J. van der Laan) 610a8c0 Move SetThreadPriority implementation to util.cpp instead of the header (Wladimir J. van der Laan) f780e65 Remove unused function `ByteReverse` from util.h (Wladimir J. van der Laan) 121d6ad Remove unused `alignup` function from util.h (Wladimir J. van der Laan) d1e26d4 Move CMedianFilter to timedata.cpp (Wladimir J. van der Laan)
| * Split up util.cpp/hWladimir J. van der Laan2014-08-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* | Make appropriate getter-routines "const" in CCoinsView.Daniel Kraft2014-08-261-5/+8
|/ | | | Mark the "Get"/"Have" routines in CCoinsView and subclasses as "const".
* Allow BatchWrite to destroy its input, reducing copyingPieter Wuille2014-08-241-2/+5
|
* Changed LevelDB cursors to use scoped pointers to ensure destruction when ↵Ross Nicoll2014-08-161-4/+2
| | | | | | | | going out of scope. This corrects a bug where an exception thrown reading from the database causes the cursor to be left open, which causes an assertion error to occur when the database is deleted (around line 938 of init.cpp).
* typedef std::map<uint256, CCoins> to CCoinsMapWladimir J. van der Laan2014-07-011-2/+2
| | | | | | | This makes it possible to switch to a more efficient map type without changing all occurences manually. Merges half of #4413.
* Refactor proof of work related functions out of mainjtimon2014-06-231-2/+3
|
* Move {Get,Set}Compact from bignum to uint256Pieter Wuille2014-05-091-6/+0
|
* use standard __func__ instead of __PRETTY_FUNCTION__Philip Kaufmann2014-04-301-2/+2
|
* Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron2014-02-091-1/+1
| | | | | | in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
* Remove redundant .c_str()sWladimir J. van der Laan2014-01-231-1/+1
| | | | | | | After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
* extend std::exception logging in txdb.cppPhilip Kaufmann2013-12-201-6/+6
|