0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00
bitcoin-core/src
Wladimir J. van der Laan f09bc7ec98
Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down
c1dde3a949 No longer shutdown after encrypting the wallet (Andrew Chow)
d7637c5a3f After encrypting the wallet, reload the database environment (Andrew Chow)
5d296ac810 Add function to close all Db's and reload the databae environment (Andrew Chow)
a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow)

Pull request description:

  This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511).

  Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

  To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

  As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

  cc @ryanofsky

Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2018-09-14 10:43:35 +02:00
..
bench Merge #13792: tx pool: Avoid passing redundant hash into addUnchecked (scripted-diff) 2018-08-29 16:30:58 +02:00
compat Merge #13665: [build] Add risc-v support to gitian 2018-08-16 20:33:50 +02:00
config
consensus Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
crypto Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
index Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
interfaces [build] remove #ifdef ENABLE_WALLET from interfaces/node 2018-09-13 09:37:37 -04:00
leveldb Merge leveldb subtree 2018-08-09 11:31:45 -04:00
obj
obj-test
policy Merge #13558: Drop unused GetType() from CSizeComputer 2018-09-11 09:29:38 +02:00
primitives Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
qt Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down 2018-09-14 10:43:35 +02:00
rpc Merge #14192: utils: Convert fs::filesystem_error messages from local multibyte to utf-8 on Windows 2018-09-13 17:30:27 +02:00
script Merge #13558: Drop unused GetType() from CSizeComputer 2018-09-11 09:29:38 +02:00
secp256k1
support Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
test Merge #13558: Drop unused GetType() from CSizeComputer 2018-09-11 09:29:38 +02:00
univalue Update univalue subtree 2018-09-07 08:21:14 -04:00
wallet Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting down 2018-09-14 10:43:35 +02:00
zmq Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
.clang-format Fix inconsistent namespace formatting guidelines 2018-04-13 15:37:20 -04:00
addrdb.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrdb.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
amount.h
arith_uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
arith_uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
bech32.cpp Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
bech32.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
bitcoin-cli-res.rc
bitcoin-cli.cpp don't translate command line options 2018-09-10 13:08:25 +02:00
bitcoin-tx-res.rc
bitcoin-tx.cpp Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
bitcoind-res.rc
bitcoind.cpp util: Replace boost::signals2 with std::function 2018-08-24 08:34:38 -04:00
blockencodings.cpp Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
blockencodings.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
blockfilter.cpp blockfilter: Omit empty scripts from filter contents. 2018-08-28 12:12:32 -07:00
blockfilter.h blockfilter: Additional helper methods to compute hash and header. 2018-08-25 10:02:37 -07:00
bloom.cpp Merge #13429: Return the script type from Solver 2018-08-25 17:41:00 +02:00
bloom.h Removes unsed CBloomFilter constructor. 2018-08-13 01:24:55 +02:00
chain.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chain.h [trivial] Fix typo in CDiskBlockPos struct's ToString 2018-08-14 18:03:43 -05:00
chainparams.cpp doxygen: Remove misleading checkpoints comment in CMainParams 2018-09-04 13:42:42 -04:00
chainparams.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
chainparamsbase.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsseeds.h net: Update hardcoded seeds 2018-08-13 13:57:15 +02:00
checkpoints.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkpoints.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkqueue.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
coins.cpp Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
coins.h Preserve a format of RPC command definitions 2018-08-20 15:19:12 +02:00
compat.h Make IS_TRIVIALLY_CONSTRUCTIBLE consistent on GCC < 5 2018-08-23 10:38:59 -07:00
compressor.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compressor.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_io.h rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
core_memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_read.cpp rpc: Expose ProcessNewBlockHeaders 2018-08-13 14:27:40 -04:00
core_write.cpp Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
cuckoocache.h Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
dbwrapper.cpp Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
dbwrapper.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
dummywallet.cpp [build] remove #ifdef ENABLE_WALLET from interfaces/node 2018-09-13 09:37:37 -04:00
fs.cpp Merge #14192: utils: Convert fs::filesystem_error messages from local multibyte to utf-8 on Windows 2018-09-13 17:30:27 +02:00
fs.h utils: Convert fs error messages from multibyte to utf-8 2018-09-11 03:11:39 +08:00
hash.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
hash.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
httprpc.cpp [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
httprpc.h Cleanup StartRest() 2018-08-11 09:34:47 +03:00
httpserver.cpp scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
httpserver.h http: Add const modifier to HTTPRequest methods 2018-08-20 01:35:55 +01:00
indirectmap.h
init.cpp doc: -help-debug implies -help 2018-09-13 07:57:13 +02:00
init.h [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
key.cpp Pass export privkey DER compression flag correctly 2018-09-13 09:58:26 +02:00
key.h Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
key_io.cpp Merge #13769: Mark single-argument constructors "explicit" 2018-08-27 13:33:04 -04:00
key_io.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
limitedmap.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
logging.cpp Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP) 2018-08-29 16:05:00 +02:00
logging.h logging: Replace LogPrint macros with regular functions 2018-09-12 11:28:01 -04:00
Makefile.am build: Move interfaces/* to libbitcoin_server 2018-09-12 09:35:41 +02:00
Makefile.bench.include bench: Benchmark GCS filter creation and matching. 2018-08-25 10:02:37 -07:00
Makefile.leveldb.include
Makefile.qt.include scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
Makefile.qttest.include crypto: cleanup sha256 build 2018-06-06 17:36:53 -04:00
Makefile.test.include Merge #12775: Integration of property based testing into Bitcoin Core 2018-09-08 05:33:16 +02:00
memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
miner.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
miner.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
net.cpp Merge #14127: build: avoid getifaddrs when unavailable 2018-09-10 18:08:05 +02:00
net.h scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
net_processing.cpp Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-09-04 15:50:08 +02:00
net_processing.h p2p: Disable BIP 61 by default 2018-09-07 08:11:27 -04:00
netaddress.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
netaddress.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netbase.cpp Call unicode API on Windows 2018-09-11 21:09:46 +08:00
netbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netmessagemaker.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
noui.cpp noui: Move handlers to header file 2018-09-06 15:00:01 -04:00
noui.h noui: Move handlers to header file 2018-09-06 15:00:01 -04:00
outputtype.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
outputtype.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
prevector.h Explicitly initialize prevector _union 2018-08-27 09:50:13 -07:00
protocol.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
protocol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
random.cpp scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
random.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
rest.cpp Increase signal to noise in appveyor build output by reducing the MSVC warning count from 12 to 4 (12 is assuming the changes in #14086 are also implemented). 2018-09-03 19:53:56 +02:00
reverse_iterator.h scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
reverselock.h
scheduler.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
scheduler.h Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
serialize.h Drop minor GetSerializeSize template 2018-09-11 00:58:13 -04:00
shutdown.cpp Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
shutdown.h Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
span.h Add more methods to Span class 2018-07-27 11:52:18 -07:00
streams.h Fix typos reported by codespell 2018-09-04 13:11:26 +02:00
sync.cpp Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection 2018-08-31 16:00:38 +02:00
sync.h scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
threadinterrupt.cpp Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection 2018-08-31 16:00:38 +02:00
threadinterrupt.h scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
threadsafety.h Trivial: update clang thread-safety docs url 2018-09-02 02:49:30 -04:00
timedata.cpp Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-08-27 18:19:33 +02:00
timedata.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
tinyformat.h Fix typos 2018-03-21 08:34:44 +02:00
torcontrol.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
torcontrol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
txdb.cpp Return void instead of bool for functions that cannot fail 2018-07-27 13:19:03 +02:00
txdb.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
txmempool.cpp tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
txmempool.h tx pool: Use class methods to hide raw map iterator impl details 2018-09-07 13:04:02 -04:00
ui_interface.cpp Merge #13634: ui: Compile boost::signals2 only once 2018-08-13 15:02:38 -04:00
ui_interface.h Make macro compatible with MSVC 2018-08-14 09:19:47 +00:00
uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
undo.h Drop unused GetType() from CSizeComputer 2018-09-11 00:58:05 -04:00
util.cpp Merge #13888: Call unicode API on Windows 2018-09-13 12:11:44 +02:00
util.h Add lock annotations (cs_args) 2018-08-29 22:33:33 +02:00
utilmemory.h Extract MakeUnique into utilmemory.h 2018-07-17 13:56:21 -04:00
utilmoneystr.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilmoneystr.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilstrencodings.cpp Merge #13249: Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. 2018-09-04 15:50:08 +02:00
utilstrencodings.h Implements custom tolower and toupper functions. 2018-08-28 18:42:27 +02:00
utiltime.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utiltime.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
validation.cpp Merge #13310: Report progress in ReplayBlocks while rolling forward 2018-09-13 14:07:20 +02:00
validation.h scripted-diff: Small locking rename 2018-08-31 10:00:38 -04:00
validationinterface.cpp Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
validationinterface.h Add compile time checking for all cs_main runtime locking assertions 2018-08-26 00:25:28 +02:00
version.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
walletinitinterface.h [build] remove ENABLE_WALLET ifdef from httprpc.cpp 2018-09-10 14:27:32 -04:00
warnings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
warnings.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00