aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/db.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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-
* Use MakeUnique<Db>(...)practicalswift2017-11-091-1/+1
|
* Use MakeUnique<T>(...) instead of std::unique_ptr<T>(new T(...))practicalswift2017-11-091-2/+2
|
* Use unique_ptr for pdbCopy (Db) and fix potential memory leakpracticalswift2017-11-091-2/+1
|
* Use unique_ptr for dbenv (DbEnv)practicalswift2017-11-091-11/+8
|
* Merge #11376: Ensure backupwallet fails when attempting to backup to source fileMarcoFalke2017-11-011-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | 5d465e396 Ensure backupwallet fails when attempting to backup to source file (Tomas van der Wansem) Pull request description: Previous behaviour was to destroy the wallet (to zero-length) This fixes #11375 Tree-SHA512: bfd1738659b15e3f23b6bbdf55ec12269c62c820bf701daec19500b52bd5845bb5516733c6f76f36197eb155182a8a35dc239ad4de2ef1e59bbb0f124a455759
| * Ensure backupwallet fails when attempting to backup to source fileTomas van der Wansem2017-10-101-0/+5
| | | | | | | | Previous behaviour was to destroy the wallet (to zero-length)
* | Avoid opening copied wallet databases simultaneouslyRussell Yanofsky2017-10-191-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure wallet databases have unique fileids. If they don't, throw an error. BDB caches do not work properly when more than one open database has the same fileid, because values written to one database may show up in reads to other databases. Bitcoin will never create different databases with the same fileid, but users can create them by manually copying database files. BDB caching bug was reported by Chris Moore <[email protected]> https://github.com/bitcoin/bitcoin/issues/11429 Fixes #11429
* | [wallet] Fix leak in CDB constructorJoão Barbosa2017-10-141-18/+16
|/ | | | | | | Now using a std::unique_ptr, the Db instance is correctly released when CDB initialization fails. The internal CDB state and mapFileUseCount are only mutated when the CDB initialization succeeds.
* Merge #10845: Remove unreachable codeWladimir J. van der Laan2017-09-061-2/+0
|\ | | | | | | | | | | | | | | | | | | 41bf1598f Remove unreachable code (practicalswift) Pull request description: Remove unreachable code. Tree-SHA512: 2ae94035f693b1ac73b1587eafcc646602a185f6d2b8a24a05939b43235b331c9e6f369ad2e8208624a47c920e989413c6a89ab9b608add5b7be4ebefae2a796
| * Remove unreachable codepracticalswift2017-07-161-2/+0
| |
* | Merge #11017: [wallet] Close DB on error.Jonas Schnelli2017-08-151-4/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 03bc719a8 [wallet] Close DB on error. (Karl-Johan Alm) Pull request description: This PR intends to plug some leaks. It specifically implements adherence to the requirement in BDB to close a handle which failed to open (https://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbopen.html): > The `DB->open()` method returns a non-zero error value on failure and 0 on success. If `DB->open()` fails, the `DB->close()` method must be called to discard the DB handle. Tree-SHA512: cc1f2b925ef3fd6de785f62108fbc79454443397f80707762acbc56757841d2c32b69c0234f87805571aa40c486da31f315ca4c607a2c7d1c97c82a01301e2a6
| * | [wallet] Close DB on error.Karl-Johan Alm2017-08-091-4/+8
| |/
* | 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-
* | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-22/+22
|/ | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>Wladimir J. van der Laan2017-07-041-1/+0
|\ | | | | | | | | | | | | | | | | | | b1268a1 clang-format: Delete ForEachMacros (Jorge Timón) 5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón) 3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón) 33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón) 300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón) Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
| * scripted-diff: Remove #include <boost/foreach.hpp>Jorge Timón2017-06-221-1/+0
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp -END VERIFY SCRIPT-
* | Merge #9895: Turn TryCreateDirectory() into TryCreateDirectories()Wladimir J. van der Laan2017-06-141-1/+1
|\ \ | |/ |/| | | | | | | 1d1ea9f Turn TryCreateDirectory() into TryCreateDirectories() (Marko Bencun) Tree-SHA512: 49a524167bcf66e351a964c88d09cb3bcee12769a32da83410e3ba649fa4bcdbf0478d41e4d09bb55adb9b3f122e742271db6feb30bbafe2a7973542b5f10f79
| * Turn TryCreateDirectory() into TryCreateDirectories()Marko Bencun2017-06-141-1/+1
| | | | | | | | | | | | | | | | Use case: TryCreateDirectory(GetDataDir() / "blocks" / "index") would fail if the blocks directory was not explicitly created before. The line that did so was in a weird location and could be removed as a result.
* | Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPEPieter Wuille2017-06-131-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón) 18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón) 7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón) a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón) Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
| * | scripted-diff: Fully remove BOOST_FOREACHJorge Timón2017-06-051-1/+1
| |/ | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* | Merge #8694: Basic multiwallet supportWladimir J. van der Laan2017-06-121-8/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c237bd7 wallet: Update formatting (Luke Dashjr) 9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr) a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr) b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr) 84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr) 008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr) 0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr) b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr) 19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr) 74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr) 23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr) 9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr) f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr) Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
| * | wallet: Base backup filenames on original wallet filenameLuke Dashjr2017-06-061-2/+2
| | |
| * | wallet: Include actual backup filename in recovery warning messageLuke Dashjr2017-06-061-7/+8
| | |
| * | Wallet: Replace pwalletMain with a vector of wallet pointersLuke Dashjr2017-06-061-5/+0
| | |
| * | CWalletDB: Store the update counter per walletLuke Dashjr2017-06-051-0/+10
| |/
* | Merge #10546: Remove 33 unused Boost includesWladimir J. van der Laan2017-06-111-1/+0
|\ \ | | | | | | | | | | | | | | | 49de096 Remove unused Boost includes (practicalswift) Tree-SHA512: ff2dad94f9eeb1dc50fcffd0e94e1686be04e4e5bc45f58ae955d630c15cd25bb8f5583d0aa1f2f263b5a723be79747ef3c6e6b417c7be7787c0abc8d1874019
| * | Remove unused Boost includespracticalswift2017-06-091-1/+0
| | |
* | | Merge #10521: Limit variable scopePieter Wuille2017-06-091-1/+1
|\ \ \ | |/ / |/| | | | | | | | | | | 90593ed92 Limit variable scope (practicalswift) Tree-SHA512: 4719e303688a31aefbe1d239e86b21dd3c2045524e08bd628c6ba0c6c2a97de14d04305b9beafe0b1dcde7229793e6663168953f192e88ed409be5c30fd2a9a9
| * | Limit variable scopepracticalswift2017-06-051-1/+1
| |/
* / Remove unused variablespracticalswift2017-06-031-1/+0
|/
* Remove unused C++ code not covered by unit testspracticalswift2017-04-261-9/+0
|
* wallet: Reduce references to global bitdb environmentWladimir J. van der Laan2017-04-201-32/+42
|
* wallet: Get rid of fFileBackedWladimir J. van der Laan2017-04-201-3/+9
| | | | | | Instead, CWalletDB() with a dummy handle will just give you a no-op database in which writes always succeeds and reads always fail. CDB already had functionality for this, so just use that.
* wallet: Introduce database handle wrapperWladimir J. van der Laan2017-04-201-6/+52
| | | | | | | | Abstract database handle from explicit strFilename into CWalletDBWrapper. Also move CWallet::Backup to db.cpp - as it deals with representation details this is a database specific operation.
* Use fsbridge for fopen and freopenWladimir J. van der Laan2017-04-031-1/+1
| | | | | | | Abstracts away how a path is opened to a `FILE*`. Reduces the number of places where path is converted to a string for anything else but printing.
* Replace uses of boost::filesystem with fsWladimir J. van der Laan2017-04-031-12/+12
| | | | | | | | | Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
* Replace includes of boost/filesystem.h with fs.hWladimir J. van der Laan2017-04-031-1/+1
| | | | This is step one in abstracting the use of boost::filesystem.
* Change LogAcceptCategory to use uint32_t rather than sets of strings.Gregory Maxwell2017-04-011-9/+9
| | | | | | | | | | | | | | | | | 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.
* Rename first iterator to prevent shadowing.Pavel Janík2017-03-181-4/+4
|
* Refactor: Remove using namespace <xxx> from wallet/Karl-Johan Alm2017-03-081-20/+17
|
* [Wallet] refactor CWallet/CWalletDB/CDBJonas Schnelli2017-03-061-2/+165
| | | | | Try to hide CDB/bitdb behinde CWalletDB. Prepare for full wallet database abstraction.
* Merge #9227: Make nWalletDBUpdated atomic to avoid a potential race.Wladimir J. van der Laan2017-02-061-3/+0
|\ | | | | | | d63ff62 Make nWalletDBUpdated atomic to avoid a potential race. (Patrick Strateman)
| * Make nWalletDBUpdated atomic to avoid a potential race.Patrick Strateman2016-12-211-3/+0
| |
* | Merge #9353: Add data() method to CDataStream (and use it)Pieter Wuille2017-01-091-4/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | 5113474 wallet: Use CDataStream.data() (Wladimir J. van der Laan) e2300ff bench: Use CDataStream.data() (Wladimir J. van der Laan) adff950 dbwrapper: Use new .data() method of CDataStream (Wladimir J. van der Laan) a2141e4 streams: Remove special cases for ancient MSVC (Wladimir J. van der Laan) af4c44c streams: Add data() method to CDataStream (Wladimir J. van der Laan)
| * | wallet: Use CDataStream.data()Wladimir J. van der Laan2016-12-151-4/+4
| |/
* / Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
|/ | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Do not shadow variables.Pavel Janík2016-08-311-3/+3
|
* Berkeley DB v6 compatibility fixAlexey Vesnin2016-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | Fixes building error looking like this: CXX wallet/libbitcoin_wallet_a-db.o wallet/db.cpp: In member function ‘void CDBEnv::EnvShutdown()’: wallet/db.cpp:46:16: error: call of overloaded ‘DbEnv(int)’ is ambiguous DbEnv(0).remove(strPath.c_str(), 0); ^ wallet/db.cpp:46:16: note: candidates are: In file included from wallet/db.h:21:0, from wallet/db.cpp:6: /usr/include/db_cxx.h:916:2: note: DbEnv::DbEnv(const DbEnv&) DbEnv(const DbEnv &); ^ /usr/include/db_cxx.h:518:2: note: DbEnv::DbEnv(DB_ENV) DbEnv(DB_ENV *dbenv); ^ /usr/include/db_cxx.h:516:2: note: DbEnv::DbEnv(u_int32_t) DbEnv(u_int32_t flags); ^ Makefile:5780: recipe for target 'wallet/libbitcoin_wallet_a-db.o' failed make[2]: ** [wallet/libbitcoin_wallet_a-db.o] Error 1
* [Wallet] remove unused code/conditions in ReadAtCursorJonas Schnelli2016-08-231-1/+1
|