test: Fix segfault in the psbt_wallet_tests/psbt_updater_test

The bug was introduced in dcd6eeb64a.
This commit is contained in:
Hennadii Stepanov 2021-10-31 13:19:03 +02:00
parent 7efc628539
commit 7986faf2e0
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 8 additions and 0 deletions

View file

@ -4,6 +4,8 @@
#include <wallet/test/wallet_test_fixture.h>
#include <scheduler.h>
WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
: TestingSetup(chainName),
m_wallet(m_node.chain.get(), "", CreateMockWalletDatabase())
@ -12,3 +14,8 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
m_chain_notifications_handler = m_node.chain->handleNotifications({ &m_wallet, [](CWallet*) {} });
m_wallet_client->registerRpcs();
}
WalletTestingSetup::~WalletTestingSetup()
{
if (m_node.scheduler) m_node.scheduler->stop();
}

View file

@ -19,6 +19,7 @@
*/
struct WalletTestingSetup : public TestingSetup {
explicit WalletTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~WalletTestingSetup();
std::unique_ptr<interfaces::WalletClient> m_wallet_client = interfaces::MakeWalletClient(*m_node.chain, *Assert(m_node.args));
CWallet m_wallet;