changeset 26726:daeaf26696bb

tests: Fix dangling pwalletMain pointer in wallet tests
author Wladimir J. van der Laan <laanwj@gmail.com>
date Mon, 27 Feb 2017 13:15:39 +0100
parents f563b742362e
children 35a733e36477
files src/wallet/test/wallet_tests.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/wallet/test/wallet_tests.cpp	Mon Feb 27 08:44:32 2017 +0100
+++ b/src/wallet/test/wallet_tests.cpp	Mon Feb 27 13:15:39 2017 +0100
@@ -397,6 +397,7 @@
 
     {
         CWallet wallet;
+        CWallet *backup = ::pwalletMain;
         ::pwalletMain = &wallet;
         UniValue key;
         key.setObject();
@@ -412,6 +413,7 @@
 
         UniValue response = importmulti(request);
         BOOST_CHECK_EQUAL(response.write(), strprintf("[{\"success\":false,\"error\":{\"code\":-1,\"message\":\"Failed to rescan before time %d, transactions may be missing.\"}}]", newTip->GetBlockTimeMax()));
+        ::pwalletMain = backup;
     }
 }