|
|
@ -19,6 +19,8 @@ |
|
|
|
#include <boost/test/unit_test.hpp> |
|
|
|
#include <boost/test/unit_test.hpp> |
|
|
|
#include <univalue.h> |
|
|
|
#include <univalue.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern CWallet* pwalletMain; |
|
|
|
|
|
|
|
|
|
|
|
extern UniValue importmulti(const JSONRPCRequest& request); |
|
|
|
extern UniValue importmulti(const JSONRPCRequest& request); |
|
|
|
extern UniValue dumpwallet(const JSONRPCRequest& request); |
|
|
|
extern UniValue dumpwallet(const JSONRPCRequest& request); |
|
|
|
extern UniValue importwallet(const JSONRPCRequest& request); |
|
|
|
extern UniValue importwallet(const JSONRPCRequest& request); |
|
|
@ -402,8 +404,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) |
|
|
|
// after.
|
|
|
|
// after.
|
|
|
|
{ |
|
|
|
{ |
|
|
|
CWallet wallet; |
|
|
|
CWallet wallet; |
|
|
|
CWallet *backup = ::pwalletMain; |
|
|
|
vpwallets.insert(vpwallets.begin(), &wallet); |
|
|
|
::pwalletMain = &wallet; |
|
|
|
|
|
|
|
UniValue keys; |
|
|
|
UniValue keys; |
|
|
|
keys.setArray(); |
|
|
|
keys.setArray(); |
|
|
|
UniValue key; |
|
|
|
UniValue key; |
|
|
@ -434,7 +435,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) |
|
|
|
"downloading and rescanning the relevant blocks (see -reindex and -rescan " |
|
|
|
"downloading and rescanning the relevant blocks (see -reindex and -rescan " |
|
|
|
"options).\"}},{\"success\":true}]", |
|
|
|
"options).\"}},{\"success\":true}]", |
|
|
|
0, oldTip->GetBlockTimeMax(), TIMESTAMP_WINDOW)); |
|
|
|
0, oldTip->GetBlockTimeMax(), TIMESTAMP_WINDOW)); |
|
|
|
::pwalletMain = backup; |
|
|
|
vpwallets.erase(vpwallets.begin()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -444,7 +445,6 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) |
|
|
|
// than or equal to key birthday.
|
|
|
|
// than or equal to key birthday.
|
|
|
|
BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) |
|
|
|
BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CWallet *pwalletMainBackup = ::pwalletMain; |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
|
|
|
|
|
|
|
|
|
// Create two blocks with same timestamp to verify that importwallet rescan
|
|
|
|
// Create two blocks with same timestamp to verify that importwallet rescan
|
|
|
@ -470,7 +470,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("wallet.backup"); |
|
|
|
::pwalletMain = &wallet; |
|
|
|
vpwallets.insert(vpwallets.begin(), &wallet); |
|
|
|
::dumpwallet(request); |
|
|
|
::dumpwallet(request); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -482,7 +482,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("wallet.backup"); |
|
|
|
::pwalletMain = &wallet; |
|
|
|
vpwallets[0] = &wallet; |
|
|
|
::importwallet(request); |
|
|
|
::importwallet(request); |
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3); |
|
|
|
BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3); |
|
|
@ -495,7 +495,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SetMockTime(0); |
|
|
|
SetMockTime(0); |
|
|
|
::pwalletMain = pwalletMainBackup; |
|
|
|
vpwallets.erase(vpwallets.begin()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check that GetImmatureCredit() returns a newly calculated value instead of
|
|
|
|
// Check that GetImmatureCredit() returns a newly calculated value instead of
|
|
|
|