Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: wallet_tests.cpp #180

Merged
merged 1 commit into from Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading