aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
AgeCommit message (Collapse)Author
2015-03-12[Move Only] Move wallet related things to src/wallet/Jonas Schnelli
could once be renamed from /src/wallet to /src/legacywallet.
2015-03-03Reinitialize state in between individual unit tests.Pieter Wuille
This changes the TestingSetup fixture to be per-unit-test rather than global. Most tests don't need it, so it's only invoked in a few.
2015-01-26Merge pull request #4805Wladimir J. van der Laan
44bc988 [Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..) (Cozz Lovan)
2015-01-06Merge pull request #5520Wladimir J. van der Laan
bdb6a71 IsNull doesn't change CBlockLocator, add const hint (Pavel Janík) 1b37333 Remove no longer needed declaration of CBlockLocator (Pavel Janík)
2014-12-20Remove no longer needed declaration of CBlockLocatorPavel Janík
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-11-21Convert remaining comments in /src to doxygen formatMichael Ford
- Update comments in checkpoints to be doxygen compatible - Update comments in checkqueue to be doxygen compatible - Update coins to be doxygen compatible - Fix comment typo in crypter.h - Update licenses/copyright dates Closes #5325 #5184 #5183 #5182
2014-10-29Separate protocol versioning from clientversionCory Fields
2014-10-22boost: split stream classes out of serialize.hCory Fields
serialization now has no dependencies.
2014-10-03[Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..)Cozz Lovan
2014-09-19Apply clang-format on some infrequently-updated filesPieter Wuille
2014-09-18prefer const string& over char* in CDB and CWalletDB constructorPhilip Kaufmann
- also make parameter of CDBEnv::CheckpointLSN a constant reference
2014-09-16Merge pull request #4911Pieter Wuille
611116d header include cleanup (Philip Kaufmann)
2014-09-15Fixing compiler warning C4101ENikS
Github-Pull: #4856
2014-09-14header include cleanupPhilip Kaufmann
- ensures alphabetical ordering for includes etc. in source file headers
2014-08-10remove unused class CAddrMan; from db.hPhilip Kaufmann
2013-12-04Move CAddrDB frrom db to netWladimir J. van der Laan
This was a leftover from the times in which peers.dat depended in BDB. Other functions in db.cpp still depend on BerkelyDB, to be able to compile without BDB this (small) functionality needs to be moved to another file.
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-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3
2013-10-15Reimplement CBlockLocator's chain-related logic in CChain.Pieter Wuille
This removes a few unused CBlockLocator methods, and moves the construction and fork-finding logic to CChain (which can do these more efficiently, as it has a height-indexable chain available). It also makes CBlockLocator independent from the validation code.
2013-06-19Introduce a CChainParameters singleton class and regtest mode.Mike Hearn
The new class is accessed via the Params() method and holds most things that vary between main, test and regtest networks. The regtest mode has two purposes, one is to run the bitcoind/bitcoinj comparison tool which compares two separate implementations of the Bitcoin protocol looking for divergence. The other is that when run, you get a local node which can mine a single block instantly, which is highly convenient for testing apps during development as there's no need to wait 10 minutes for a block on the testnet.
2013-06-05Get rid of db dependencies on mainEric Lombrozo
2013-04-24Remove database/ after clean shutdownPieter Wuille
2013-04-03Clean up shutdown processGavin Andresen
2012-11-18Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()Philip Kaufmann
- can be triggerd by just adding -proxy=crashme with 0.7.1 - crash occured, when AppInit2() was left with return false; after the first call to bitdb.open() (Step 6 in init) - this is caused by GetDataDir() or .string() in CDBEnv::EnvShutdown() called via the bitdb global destructor - init fDbEnvInit and fMockDb to false in CDBEnv::CDBEnv()
2012-11-10simplify CDBEnv::Open() / fix small glitchesPhilip Kaufmann
- remove pathEnv from CDBEnv, as this attribute is not needed - change path parameter in ::Open() to a reference - make nDbCache variable an unsigned integer - remove a missplaced ";" behin ::IsMock()
2012-11-04Remove -detachdb and stop's detach argument.Pieter Wuille
As the only BDB database left is the wallet, and it is always detached. Also remove IsChainFile() predicate and related chainfile-specific logic.
2012-10-20LevelDB block and coin databasesPieter Wuille
Split off CBlockTreeDB and CCoinsViewDB into txdb-*.{cpp,h} files, implemented by either LevelDB or BDB. Based on code from earlier commits by Mike Hearn in his leveldb branch.
2012-10-20Use singleton block tree database instancePieter Wuille
2012-10-20Batch block connection during IBDPieter Wuille
During the initial block download (or -loadblock), delay connection of new blocks a bit, and perform them in a single action. This reduces the load on the database engine, as subsequent blocks often update an earlier block's transaction already.
2012-10-20UltraprunePieter Wuille
This switches bitcoin's transaction/block verification logic to use a "coin database", which contains all unredeemed transaction output scripts, amounts and heights. The name ultraprune comes from the fact that instead of a full transaction index, we only (need to) keep an index with unspent outputs. For now, the blocks themselves are kept as usual, although they are only necessary for serving, rescanning and reorganizing. The basic datastructures are CCoins (representing the coins of a single transaction), and CCoinsView (representing a state of the coins database). There are several implementations for CCoinsView. A dummy, one backed by the coins database (coins.dat), one backed by the memory pool, and one that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock, DisconnectBlock, ... now operate on a generic CCoinsView. The block switching logic now builds a single cached CCoinsView with changes to be committed to the database before any changes are made. This means no uncommitted changes are ever read from the database, and should ease the transition to another database layer which does not support transactions (but does support atomic writes), like LevelDB. For the getrawtransaction() RPC call, access to a txid-to-disk index would be preferable. As this index is not necessary or even useful for any other part of the implementation, it is not provided. Instead, getrawtransaction() uses the coin database to find the block height, and then scans that block to find the requested transaction. This is slow, but should suffice for debug purposes.
2012-10-20Multiple blocks per filePieter Wuille
Change the block storage layer again, this time with multiple files per block, but tracked by txindex.dat database entries. The file format is exactly the same as the earlier blk00001.dat, but with smaller files (128 MiB for now). The database entries track how many bytes each block file already uses, how many blocks are in it, which range of heights is present and which range of dates.
2012-10-08Handle corrupt wallets gracefully.Gavin Andresen
Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a crash. This commit does three things: 1) Runs a BDB verify early in the startup process, and if there is a low-level problem with the database: + Moves the bad wallet.dat to wallet.timestamp.bak + Runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat + Continues with startup. 2) Much more tolerant of serialization errors. All errors in deserialization are reported by tolerated EXCEPT for errors related to reading keypairs or master key records-- those are reported and then shut down, so the user can get help (or recover from a backup). 3) Adds a new -salvagewallet option, which: + Moves the wallet.dat to wallet.timestamp.bak + extracts ONLY keypairs and master keys into a new wallet.dat + soft-sets -rescan, to recreate transaction history This was tested by randomly corrupting testnet wallets using a little python script I wrote (https://gist.github.com/3812689)
2012-07-11Run BDB disk-less for test_bitcoinLuke Dashjr
2012-06-20Remove CTxDB::ReadOwnerTxes.Pieter Wuille
It seems it wasn't ever used since 0.1.5.
2012-05-23Refactor: add IsChainFile helper. LoadBlockIndex() code movement.Jeff Garzik
2012-05-22CDBEnv: fix qt buildLuke Dashjr
2012-05-22Merge branch 'dbenv' into tmpJeff Garzik
Conflicts: src/db.cpp
2012-05-22Prevent crashes due to missing or corrupted database recordsJeff Garzik
Any problems seen during deserialization will throw an uncaught exception, crashing the entire bitcoin process. Properly return an error instead, so that we may at least log the error and gracefully shutdown other portions of the app.
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-19Further CDBEnv encapsulation work.Jeff Garzik
2012-05-19Remove unused nested BDB transaction supportJeff Garzik
2012-05-19Create CDBEnv::TxnBegin(), and use it in CDB::TxnBegin()Jeff Garzik
2012-05-19Encapsulate BDB environment inside new CDBEnv classJeff Garzik
Cleans up and organizes several scattered functions and variables related to the BDB env. Class CDBInit() existed to provide a guaranteed-via-C++-destructor cleanup of the db environment. A formal CDBEnv class provides all of this inside a single wrapper.
2012-05-19Default to DB_TXN_WRITE_NOSYNC for all transactional operationsJeff Garzik
* This is safer than DB_TXN_NOSYNC, and does not appear to impact performance. * Applying this to the dbenv is necessary to avoid many fdatasync(2) calls on db 5.x * We carefully and thoroughly flush databases upon shutdown and other important events already.
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-17Merge pull request #1316 from jgarzik/dead-codeJeff Garzik
Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk()
2012-05-16CAddrDB: Replace BDB-managed addr.dat with internally managed peers.datJeff Garzik
2012-05-15Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk()Jeff Garzik