diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-04-17 18:28:54 +0100 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-04-17 18:28:54 +0100 |
commit | d41a42056204d20b4413b1c78d26da56605bf34c (patch) | |
tree | 06107232c45150bebd9c1292273de4be7af0ee85 | |
parent | 58bbc5521235f0db77f1f41edd17859fd5664fca (diff) |
test: Fix dangling wallet pointer in vpwallets
-rw-r--r-- | src/wallet/test/wallet_tests.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index 14c5ad7214..0eba87b4c9 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -142,6 +142,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) request.params.push_back((pathTemp / "wallet.backup").string()); vpwallets.insert(vpwallets.begin(), &wallet); ::dumpwallet(request); + vpwallets.erase(vpwallets.begin()); } // Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME @@ -152,8 +153,9 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) JSONRPCRequest request; request.params.setArray(); request.params.push_back((pathTemp / "wallet.backup").string()); - vpwallets[0] = &wallet; + vpwallets.insert(vpwallets.begin(), &wallet); ::importwallet(request); + vpwallets.erase(vpwallets.begin()); LOCK(wallet.cs_wallet); BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3U); @@ -166,7 +168,6 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) } SetMockTime(0); - vpwallets.erase(vpwallets.begin()); } // Check that GetImmatureCredit() returns a newly calculated value instead of |