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
test: Remove unused coin_selection param #26110
test: Remove unused coin_selection param #26110
Conversation
I don't think it is unused. There are a number of calls to Note that the tests are not exhaustive. If tests do not fail due to removal of code, it is not necessarily that the code was unnecessary or unused, but often that the test was deficient. |
@achow101 yes that's true, however this is part of It's confusing that the tests use |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
NACK. I added P.S. |
The test suit should fail then if it is used, however the tests all pass. Under what circumstance would |
The coins supplied to the selection algorithm are of round value and match exactly the target, which is the reason why BnB should be used in Since BnB does not create change outputs, wouldn't it make sense to remove Suggestiondiff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index 264c0aa59..4a5309a4f 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -345,6 +345,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
coin_selection_params_bnb.m_effective_feerate = CFeeRate(0);
const auto result10 = SelectCoins(*wallet, available_coins, selected_input, 10 * CENT, coin_control, coin_selection_params_bnb);
BOOST_CHECK(result10);
+ BOOST_CHECK_EQUAL(result10->GetAlgo(), SelectionAlgorithm::BNB);
}
{
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
@@ -368,6 +369,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
CCoinControl coin_control;
const auto result11 = SelectCoins(*wallet, available_coins, /*pre_set_inputs=*/{}, 10 * CENT, coin_control, coin_selection_params_bnb);
BOOST_CHECK(EquivalentResult(expected_result, *result11));
+ BOOST_CHECK_EQUAL(result11->GetAlgo(), SelectionAlgorithm::BNB);
available_coins.Clear();
// more coins should be selected when effective fee < long term fee
@@ -383,6 +385,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
add_coin(1 * CENT, 2, expected_result);
const auto result12 = SelectCoins(*wallet, available_coins, /*pre_set_inputs=*/{}, 10 * CENT, coin_control, coin_selection_params_bnb);
BOOST_CHECK(EquivalentResult(expected_result, *result12));
+ BOOST_CHECK_EQUAL(result12->GetAlgo(), SelectionAlgorithm::BNB);
available_coins.Clear();
// pre selected coin should be selected even if disadvantageous
@@ -404,6 +407,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
available_coins.coins[OutputType::BECH32].erase(++available_coins.coins[OutputType::BECH32].begin());
const auto result13 = SelectCoins(*wallet, available_coins, selected_input, 10 * CENT, coin_control, coin_selection_params_bnb);
BOOST_CHECK(EquivalentResult(expected_result, *result13));
+ BOOST_CHECK_EQUAL(result13->GetAlgo(), SelectionAlgorithm::BNB);
}
} |
It seems to me it would be cleaner to just test
I think we are driving at the same thing. |
However, I'm not sure whether option 3 is a good option in light of #26466 |
https://github.com/bitcoin/bitcoin/blob/master/src/wallet/coinselection.cpp#L159 As I mentioned above, I do think it's better to have the tests |
91416ee
to
c65f842
Compare
The feature request didn't seem to attract much attention in the past. Also, the issue seems not important enough right now to keep it sitting around idle in the list of open issues. Closing due to lack of interest. Pull requests with improvements are always welcome. |
The param
min_viable_change
is never used in any of the subsequent tests and can be removed.