Commit Graph

91 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 177433ad22
Merge #8694: Basic multiwallet support
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
2017-06-12 13:27:17 +02:00
Wladimir J. van der Laan 2c2d988062
Merge #10546: Remove 33 unused Boost includes
49de096 Remove unused Boost includes (practicalswift)

Tree-SHA512: ff2dad94f9eeb1dc50fcffd0e94e1686be04e4e5bc45f58ae955d630c15cd25bb8f5583d0aa1f2f263b5a723be79747ef3c6e6b417c7be7787c0abc8d1874019
2017-06-11 15:37:15 +02:00
Pieter Wuille 76f268b9bd
Merge #10521: Limit variable scope
90593ed92 Limit variable scope (practicalswift)

Tree-SHA512: 4719e303688a31aefbe1d239e86b21dd3c2045524e08bd628c6ba0c6c2a97de14d04305b9beafe0b1dcde7229793e6663168953f192e88ed409be5c30fd2a9a9
2017-06-09 13:09:24 -07:00
practicalswift 49de096c2a Remove unused Boost includes 2017-06-09 10:25:26 +02:00
Luke Dashjr a2a5f3f0f0 wallet: Base backup filenames on original wallet filename 2017-06-06 21:20:22 +00:00
Luke Dashjr b823a4c9f6 wallet: Include actual backup filename in recovery warning message 2017-06-06 21:17:09 +00:00
Luke Dashjr b124cf04ea Wallet: Replace pwalletMain with a vector of wallet pointers 2017-06-06 21:17:09 +00:00
Luke Dashjr 19b3648bb5 CWalletDB: Store the update counter per wallet 2017-06-05 22:27:57 +00:00
Jorge Timón 7c00c26726
scripted-diff: Fully remove BOOST_FOREACH
-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-
2017-06-05 20:10:50 +02:00
practicalswift 90593ed92c Limit variable scope 2017-06-05 00:52:36 +02:00
practicalswift a8c09affce Remove unused variables 2017-06-03 23:54:24 +02:00
practicalswift b51aaf1c42 Remove unused C++ code not covered by unit tests 2017-04-26 21:20:02 +02:00
Wladimir J. van der Laan be9e1a968d wallet: Reduce references to global bitdb environment 2017-04-20 17:15:31 +02:00
Wladimir J. van der Laan 071c95570b wallet: Get rid of fFileBacked
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.
2017-04-20 17:15:31 +02:00
Wladimir J. van der Laan 71afe3c099 wallet: Introduce database handle wrapper
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.
2017-04-20 17:15:30 +02:00
Wladimir J. van der Laan 2a5f574762 Use fsbridge for fopen and freopen
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.
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan bac5c9cf64 Replace uses of boost::filesystem with fs
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'
```
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan 7d5172d354 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2017-04-03 12:32:32 +02:00
Gregory Maxwell 6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
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.
2017-04-01 18:53:29 +00:00
Pavel Janík d7f80b6dcb Rename first iterator to prevent shadowing. 2017-03-18 07:59:51 +01:00
Karl-Johan Alm 8a5228197c
Refactor: Remove using namespace <xxx> from wallet/ 2017-03-08 08:46:59 -08:00
Jonas Schnelli 7184e25c80
[Wallet] refactor CWallet/CWalletDB/CDB
Try to hide CDB/bitdb behinde CWalletDB.
Prepare for full wallet database abstraction.
2017-03-06 11:30:24 +01:00
Wladimir J. van der Laan 02464da5e4
Merge #9227: Make nWalletDBUpdated atomic to avoid a potential race.
d63ff62 Make nWalletDBUpdated atomic to avoid a potential race. (Patrick Strateman)
2017-02-06 16:14:17 +01:00
Pieter Wuille 07fd147b9f
Merge #9353: Add data() method to CDataStream (and use it)
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)
2017-01-09 08:47:47 -08:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Patrick Strateman d63ff6265b Make nWalletDBUpdated atomic to avoid a potential race. 2016-12-21 13:49:48 -08:00
Wladimir J. van der Laan 5113474a91 wallet: Use CDataStream.data() 2016-12-15 17:34:59 +01:00
Pavel Janík b175cb755b Do not shadow variables. 2016-08-31 16:16:05 +02:00
Alexey Vesnin 323a5fe06a Berkeley DB v6 compatibility fix
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
2016-08-30 09:00:55 +03:00
Jonas Schnelli beef966e36
[Wallet] remove unused code/conditions in ReadAtCursor 2016-08-23 15:36:23 +02:00
crowning- fab2e26d20 CDB: fix debug output
It doesn't really help to clear a variable before printing it to the debug log.
2016-08-18 16:52:38 +02:00
Wladimir J. van der Laan 78e81b0bc5
Merge #7537: wallet: Warn on unexpected EOF while salvaging wallet
ca8fb59 wallet: Warn on unexpected EOF while salvaging wallet (Wladimir J. van der Laan)
2016-02-29 10:05:07 +01:00
Wladimir J. van der Laan f31b6b8995 test: test leading space for ParseHex
BerkeleyDB dump files have key and value lines indented.
The salvage code passes these to ParseHex as-is.
Check this in the tests (should just pass with current code).
2016-02-15 17:14:30 +01:00
Wladimir J. van der Laan ca8fb59ae1 wallet: Warn on unexpected EOF while salvaging wallet
Check for EOF before every getline, and warn when reading gets to EOF
before the end of the data.

Stricter error checking could shed more light on issues such as #7463
and #7379.
2016-02-15 16:35:12 +01:00
MarcoFalke fa6d4cc095 [walletdb] Fix syntax error in key parser 2016-01-20 09:44:53 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Luke Dashjr b966aa836a Constrain constant values to a single location in code 2015-11-28 18:47:29 +01:00
Luke Dashjr 420a82f1ae Bugfix: Describe dblogsize option correctly (it refers to the wallet database, not memory pool) 2015-10-01 23:16:42 +00:00
Philip Kaufmann 0ce30eaa36 fix crash on shutdown when e.g. changing -txindex and abort action
- fixes #3136
- the problem is related to Boost path and a static initialized internal
  pointer
- using a std::string in CDBEnv::EnvShutdown() prevents the problem
- this removes the boost::filesystem::path path field from CDBEnv
2015-06-16 15:03:50 +02:00
Philip Kaufmann 341e2385d5 use constant references for strings in functions in wallet/*.* 2015-03-21 18:40:51 +01:00
Jonas Schnelli 50c72f23ad [Move Only] Move wallet related things to src/wallet/
could once be renamed from /src/wallet to /src/legacywallet.
2015-03-12 14:13:02 +01:00