diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-10-10 15:27:26 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-11-01 15:23:06 -0400 |
commit | 9c8006dc332139069d798f39406ec67186ecb311 (patch) | |
tree | 84b4f3330847e5bb0d1a5ddcb1827123a0f6caec /test/functional/multiwallet.py | |
parent | de7053f1141756158c2107bcba376401b4cc94e9 (diff) | |
download | bitcoin-9c8006dc332139069d798f39406ec67186ecb311.tar.xz |
Avoid opening copied wallet databases simultaneously
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 <dooglus@gmail.com>
https://github.com/bitcoin/bitcoin/issues/11429
Fixes #11429
Github-Pull: #11476
Rebased-From: 478a89c1ef79a75275d1b508122c06eee9386b2d
Diffstat (limited to 'test/functional/multiwallet.py')
-rwxr-xr-x | test/functional/multiwallet.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/multiwallet.py b/test/functional/multiwallet.py index 6adcc1fd88..ba6b659ddc 100755 --- a/test/functional/multiwallet.py +++ b/test/functional/multiwallet.py @@ -7,6 +7,7 @@ Verify that a bitcoind node can load multiple wallet files """ import os +import shutil from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, assert_raises_rpc_error @@ -29,6 +30,11 @@ class MultiWalletTest(BitcoinTestFramework): os.mkdir(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w11')) self.assert_start_raises_init_error(0, ['-wallet=w11'], 'Error loading wallet w11. -wallet filename must be a regular file.') + # should not initialize if one wallet is a copy of another + shutil.copyfile(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w2'), + os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w22')) + self.assert_start_raises_init_error(0, ['-wallet=w2', '-wallet=w22'], 'duplicates fileid') + # should not initialize if wallet file is a symlink os.symlink(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w1'), os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w12')) self.assert_start_raises_init_error(0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.') |