Skip to content

Commit

Permalink
Update wallet_tests.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan committed Feb 28, 2024
1 parent 569ec22 commit d450dd4
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/wallet/test/wallet_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,10 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
}
BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), COINBASE_MATURITY_2 - COINBASE_MATURITY + 1);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 1U);

// Check initial balance from one mature coinbase transaction.
CAmount expectedAmount = 0;
for (auto i = COINBASE_MATURITY; i < COINBASE_MATURITY_2 + 1; ++i) {
expectedAmount += GetBlockSubsidy(i, Params().GetConsensus());
}
BOOST_CHECK_EQUAL(expectedAmount, wallet->GetAvailableBalance());
BOOST_CHECK_EQUAL(72000 * COIN, wallet->GetAvailableBalance());

// Add a transaction creating a change address, and confirm ListCoins still
// returns the coin associated with the change address underneath the
Expand All @@ -568,14 +564,14 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
}
BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), COINBASE_MATURITY_2 - COINBASE_MATURITY + 2);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 2U);

// Lock both coins. Confirm number of available coins drops to 0.
{
LOCK(wallet->cs_wallet);
std::vector<COutput> available;
wallet->AvailableCoins(available);
BOOST_CHECK_EQUAL(available.size(), COINBASE_MATURITY_2 - COINBASE_MATURITY + 2);
BOOST_CHECK_EQUAL(available.size(), 2U);
}
for (const auto& group : list) {
for (const auto& coin : group.second) {
Expand All @@ -597,7 +593,7 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
}
BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), COINBASE_MATURITY_2 - COINBASE_MATURITY + 2);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 2U);
}

BOOST_FIXTURE_TEST_CASE(wallet_disableprivkeys, TestChain100Setup)
Expand Down

0 comments on commit d450dd4

Please sign in to comment.