Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/wallettests.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | if (QApplication::platformName() == "minimal") { | ||||
QWARN("Skipping WalletTests on mac build with 'minimal' platform set " | QWARN("Skipping WalletTests on mac build with 'minimal' platform set " | ||||
"due to Qt bugs. To run AppTests, invoke " | "due to Qt bugs. To run AppTests, invoke " | ||||
"with 'test_bitcoin-qt -platform cocoa' on mac, or else use a " | "with 'test_bitcoin-qt -platform cocoa' on mac, or else use a " | ||||
"linux or windows build."); | "linux or windows build."); | ||||
return; | return; | ||||
} | } | ||||
#endif | #endif | ||||
g_address_type = OutputType::LEGACY; | |||||
g_change_type = OutputType::LEGACY; | |||||
// Set up wallet and chain with 105 blocks (5 mature blocks for spending). | // Set up wallet and chain with 105 blocks (5 mature blocks for spending). | ||||
TestChain100Setup test; | TestChain100Setup test; | ||||
for (int i = 0; i < 5; ++i) { | for (int i = 0; i < 5; ++i) { | ||||
test.CreateAndProcessBlock( | test.CreateAndProcessBlock( | ||||
{}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); | {}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); | ||||
} | } | ||||
CWallet wallet(Params(), "mock", WalletDatabase::CreateMock()); | CWallet wallet(Params(), "mock", WalletDatabase::CreateMock()); | ||||
bool firstRun; | bool firstRun; | ||||
wallet.LoadWallet(firstRun); | wallet.LoadWallet(firstRun); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetAddressBook( | wallet.SetAddressBook( | ||||
GetDestinationForKey(test.coinbaseKey.GetPubKey(), g_address_type), | GetDestinationForKey(test.coinbaseKey.GetPubKey(), | ||||
wallet.m_default_address_type), | |||||
"", "receive"); | "", "receive"); | ||||
wallet.AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey()); | wallet.AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey()); | ||||
} | } | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
WalletRescanReserver reserver(&wallet); | WalletRescanReserver reserver(&wallet); | ||||
reserver.reserve(); | reserver.reserve(); | ||||
wallet.ScanForWalletTransactions(chainActive.Genesis(), nullptr, | wallet.ScanForWalletTransactions(chainActive.Genesis(), nullptr, | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |