aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
AgeCommit message (Collapse)Author
2016-05-06Merge #7815: Break circular dependency main ↔ txdbWladimir J. van der Laan
99e7075 Break circular dependency main ↔ txdb (Wladimir J. van der Laan)
2016-04-23dbwrapper: Pass parent CDBWrapper into CDBBatch and CDBIteratorWladimir J. van der Laan
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.
2016-04-18txdb: Fix assert crash in new UTXO set cursorWladimir J. van der Laan
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.
2016-04-15Break circular dependency main ↔ txdbWladimir J. van der Laan
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.
2016-04-15txdb: Add Cursor() method to CCoinsView to iterate over UTXO setWladimir J. van der Laan
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.
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-10-28Fix chainstate serialized_size computationPieter Wuille
2015-10-22leveldbwrapper symbol rename: Remove "Level" from class, etc. namesJeff Garzik
2015-10-13trivial: use constants for db keysDaniel Kraft
Replace literal occurances of the key "prefixes" 'c' and 'b' in txdb.cpp by the respective constants.
2015-10-09Refer to obfuscate_key via pointer in peripheral CLevelDB classesJames O'Beirne
cc @sipa
2015-10-08Handle obfuscation in CLevelDBIteratorJames O'Beirne
2015-10-08Encapsulate CLevelDB iterators cleanlyPieter Wuille
Conflicts: src/leveldb.cpp src/leveldb.h src/txdb.cpp
2015-10-06Add chainstate obfuscation to avoid spurious antivirus detectionJames O'Beirne
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.
2015-07-23TRIVIAL: Missing includesJorge Timón
2015-06-16rpc: make `gettxoutsettinfo` run lock-freeWladimir J. van der Laan
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.
2015-03-26Consensus: Refactor: Decouple pow.o from chainparams.oJorge Timón
2015-03-24Includes: Do not include main.h from any other headerJorge Timón
2015-01-31Remove whitespaces before double colon in errors and logsPavel Janík
2015-01-25change hardcoded character constants to a set of descriptive named constants ↵Earlz
for database keys
2015-01-05Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan
Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19Merge pull request #5470Wladimir J. van der Laan
78253fc Remove references to X11 licence (Michael Ford)
2014-12-17make all catch() arguments constPhilip Kaufmann
- 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
2014-12-16Remove references to X11 licenceMichael Ford
2014-11-25Do all block index writes in a batchPieter Wuille
2014-10-27MOVEONLY: Separate CTransaction and dependencies from corejtimon
2014-10-21rpc: Fix leveldb iterator leak, and flush before `gettxoutsetinfo`Wladimir J. van der Laan
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.
2014-10-08Merge pull request #4834Pieter Wuille
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)
2014-09-26Use a typedef for monetary valuesMark Friedenbach
2014-09-23Do not keep fully spent but unwritten CCoins entries cached.Pieter Wuille
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.
2014-09-23Get rid of CCoinsView's SetCoins and SetBestBlock.Pieter Wuille
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.
2014-09-14header include cleanupPhilip Kaufmann
- ensures alphabetical ordering for includes etc. in source file headers
2014-08-26Merge pull request #4748Pieter Wuille
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)
2014-08-26Split up util.cpp/hWladimir J. van der Laan
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.
2014-08-26Make appropriate getter-routines "const" in CCoinsView.Daniel Kraft
Mark the "Get"/"Have" routines in CCoinsView and subclasses as "const".
2014-08-24Allow BatchWrite to destroy its input, reducing copyingPieter Wuille
2014-08-16Changed LevelDB cursors to use scoped pointers to ensure destruction when ↵Ross Nicoll
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).
2014-07-01typedef std::map<uint256, CCoins> to CCoinsMapWladimir J. van der Laan
This makes it possible to switch to a more efficient map type without changing all occurences manually. Merges half of #4413.
2014-06-23Refactor proof of work related functions out of mainjtimon
2014-05-09Move {Get,Set}Compact from bignum to uint256Pieter Wuille
2014-04-30use standard __func__ instead of __PRETTY_FUNCTION__Philip Kaufmann
2014-02-09Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron
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.
2014-01-23Remove redundant .c_str()sWladimir J. van der Laan
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.
2013-12-20extend std::exception logging in txdb.cppPhilip Kaufmann
2013-11-10Make CCoinsView use block hashes instead of indicesPieter Wuille
2013-11-10Cleanup code using forward declarations.Brandon Dahler
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
2013-11-08Rename leveldb.{h,cpp} to leveldbwrapper.{h,cpp}.Brandon Dahler
2013-11-01Do not use the redundant BestInvalidWork record in the block database.Pieter Wuille
As block index entries have a flag for marking invalid blocks, the 'best invalid work' information can be derived from there. In addition, remove the global from main.h
2013-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3