Merge #10927: test: Make sure wallet.backup is created in temp path

88af227 test: Make sure wallet.backup is created in temp path (Wladimir J. van der Laan)

Pull request description:

  This assures that we don't overwrite a random file called `wallet.backup` that happens to be in the current directory. It also assures that the temporary file will be cleaned up.

  Noticed by Evan Klitzke, came up in discussion here: https://github.com/bitcoin/bitcoin/pull/10880#discussion_r128460722

Tree-SHA512: 2d2c23c2deba26a1130a29279b3d8565b277eb90a98a6a6d7dd4948f5cbbd5ec5453b3082e3e4e21e0e2423e642bbd2f4433e4c21032d3c8cff27ee35e87e7e7
This commit is contained in:
Wladimir J. van der Laan 2017-07-25 21:56:07 +02:00
commit 9d5e8f92a7
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

View File

@ -469,7 +469,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
JSONRPCRequest request; JSONRPCRequest request;
request.params.setArray(); request.params.setArray();
request.params.push_back("wallet.backup"); request.params.push_back((pathTemp / "wallet.backup").string());
vpwallets.insert(vpwallets.begin(), &wallet); vpwallets.insert(vpwallets.begin(), &wallet);
::dumpwallet(request); ::dumpwallet(request);
} }
@ -481,7 +481,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
JSONRPCRequest request; JSONRPCRequest request;
request.params.setArray(); request.params.setArray();
request.params.push_back("wallet.backup"); request.params.push_back((pathTemp / "wallet.backup").string());
vpwallets[0] = &wallet; vpwallets[0] = &wallet;
::importwallet(request); ::importwallet(request);