Skip to content

Commit 0d12570

Browse files
committed
Merge #13007: test: Fix dangling wallet pointer in vpwallets
d41a420 test: Fix dangling wallet pointer in vpwallets (João Barbosa) Pull request description: Tree-SHA512: 83e4ec571f1675b3dab6f7606f29d6fae495d998b4e5794ff14315943783d4518cfa66eba4113293e349eb74aa22a024b21272fdb29c212477edb4c09aec9fa7
2 parents 8fd6243 + d41a420 commit 0d12570

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/wallet/test/wallet_tests.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
142142
request.params.push_back((pathTemp / "wallet.backup").string());
143143
vpwallets.insert(vpwallets.begin(), &wallet);
144144
::dumpwallet(request);
145+
vpwallets.erase(vpwallets.begin());
145146
}
146147

147148
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME
@@ -152,8 +153,9 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
152153
JSONRPCRequest request;
153154
request.params.setArray();
154155
request.params.push_back((pathTemp / "wallet.backup").string());
155-
vpwallets[0] = &wallet;
156+
vpwallets.insert(vpwallets.begin(), &wallet);
156157
::importwallet(request);
158+
vpwallets.erase(vpwallets.begin());
157159

158160
LOCK(wallet.cs_wallet);
159161
BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3U);
@@ -166,7 +168,6 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
166168
}
167169

168170
SetMockTime(0);
169-
vpwallets.erase(vpwallets.begin());
170171
}
171172

172173
// Check that GetImmatureCredit() returns a newly calculated value instead of

0 commit comments

Comments
 (0)