Fix wallet tests

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
This commit is contained in:
Anthony Fieroni 2019-01-30 16:42:15 +02:00 committed by lbrynaut
parent 6a259cd39e
commit 3e1d2f95a0

View file

@ -52,7 +52,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
WalletRescanReserver reserver(&wallet);
reserver.reserve();
BOOST_CHECK_EQUAL(nullBlock, wallet.ScanForWalletTransactions(oldTip, nullptr, reserver));
BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 100 * COIN);
BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 2 * COIN);
}
// Prune the older block file.
@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
WalletRescanReserver reserver(&wallet);
reserver.reserve();
BOOST_CHECK_EQUAL(oldTip, wallet.ScanForWalletTransactions(oldTip, nullptr, reserver));
BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 50 * COIN);
BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 1 * COIN);
}
// Verify importmulti RPC returns failure for a key whose creation time is
@ -195,7 +195,7 @@ BOOST_FIXTURE_TEST_CASE(coin_mark_dirty_immature_credit, TestChain100Setup)
// credit amount is calculated.
wtx.MarkDirty();
wallet.AddKeyPubKey(coinbaseKey, coinbaseKey.GetPubKey());
BOOST_CHECK_EQUAL(wtx.GetImmatureCredit(), 50*COIN);
BOOST_CHECK_EQUAL(wtx.GetImmatureCredit(), 1 * COIN);
}
static int64_t AddTx(CWallet& wallet, uint32_t lockTime, int64_t mockTime, int64_t blockTime)
@ -327,13 +327,13 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
BOOST_CHECK_EQUAL(list.begin()->second.size(), 1U);
// Check initial balance from one mature coinbase transaction.
BOOST_CHECK_EQUAL(50 * COIN, wallet->GetAvailableBalance());
BOOST_CHECK_EQUAL(1 * COIN, wallet->GetAvailableBalance());
// Add a transaction creating a change address, and confirm ListCoins still
// returns the coin associated with the change address underneath the
// coinbaseKey pubkey, even though the change address has a different
// pubkey.
AddTx(CRecipient{GetScriptForRawPubKey({}), 1 * COIN, false /* subtract fee */});
AddTx(CRecipient{GetScriptForRawPubKey({}), 10 * CENT, false /* subtract fee */});
list = wallet->ListCoins();
BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress);