diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-10-10 15:27:26 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2017-10-19 09:01:43 -0400 |
commit | 478a89c1ef79a75275d1b508122c06eee9386b2d (patch) | |
tree | 9537bcd85ca45299d363560f1a6dbb6847907919 /test/functional/multiwallet.py | |
parent | 13f53b750dc09cb59192b2aa4ac8e499ee36e1ca (diff) |
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
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 f55da76819..7a0fbce477 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.') |