bugfix: Remove dangling wallet env instance
This commit is contained in:
parent
0ee77b2077
commit
0b82bac76d
2 changed files with 9 additions and 1 deletions
|
@ -694,8 +694,10 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
|
||||||
if (mapFileUseCount.empty()) {
|
if (mapFileUseCount.empty()) {
|
||||||
dbenv->log_archive(&listp, DB_ARCH_REMOVE);
|
dbenv->log_archive(&listp, DB_ARCH_REMOVE);
|
||||||
Close();
|
Close();
|
||||||
if (!fMockDb)
|
if (!fMockDb) {
|
||||||
fs::remove_all(fs::path(strPath) / "database");
|
fs::remove_all(fs::path(strPath) / "database");
|
||||||
|
}
|
||||||
|
g_dbenvs.erase(strPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,5 +796,6 @@ void BerkeleyDatabase::Flush(bool shutdown)
|
||||||
{
|
{
|
||||||
if (!IsDummy()) {
|
if (!IsDummy()) {
|
||||||
env->Flush(shutdown);
|
env->Flush(shutdown);
|
||||||
|
if (shutdown) env = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,5 +256,10 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||||
assert_equal(self.nodes[0].listwallets(), [])
|
assert_equal(self.nodes[0].listwallets(), [])
|
||||||
assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
|
assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
|
||||||
|
|
||||||
|
# Successfully load a previously unloaded wallet
|
||||||
|
self.nodes[0].loadwallet('w1')
|
||||||
|
assert_equal(self.nodes[0].listwallets(), ['w1'])
|
||||||
|
assert_equal(w1.getwalletinfo()['walletname'], 'w1')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
MultiWalletTest().main()
|
MultiWalletTest().main()
|
||||||
|
|
Loading…
Reference in a new issue