Skip to content

test: add feebumper coverage for combined bump fee failure - #34924

Closed
mkdev5 wants to merge 2 commits into
bitcoin:masterfrom
mkdev5:fix/issue-34902-feebumper-coverage
Closed

mkdev5 wants to merge 2 commits into
bitcoin:masterfrom
mkdev5:fix/issue-34902-feebumper-coverage

Conversation

@mkdev5

@mkdev5 mkdev5 commented Mar 26, 2026 •

Copy link
Copy Markdown

Closes #34902

Summary

  • Add unit test coverage for the feebumper path where calculateCombinedBumpFee() returns no value.
  • Build a 501-transaction unconfirmed dependency cluster and spend cluster tips in a wallet tx.
  • Assert CreateRateBumpTransaction() returns WALLET_ERROR with the expected error string.

Test Plan

  • build/bin/test_bitcoin --run_test=feebumper_tests --catch_system_error=no --log_level=message
  • build/bin/test_bitcoin --run_test=feebumper_tests/feerate_check_handles_combined_bump_fee_unavailable --catch_system_error=no --log_level=message

@DrahtBot DrahtBot added the Tests label Mar 26, 2026
@DrahtBot

DrahtBot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

@sedited

sedited commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

You will need to squash your last commit into the first one, if it fixes a compilation error.

CMutableTransaction bumped_tx;
const Result result = CreateRateBumpTransaction(*wallet, original_txid, coin_control, errors, old_fee, new_fee, bumped_tx, /*require_mine=*/true, /*outputs=*/{}, /*original_change_index=*/std::nullopt);

BOOST_CHECK_EQUAL(static_cast<int>(result), static_cast<int>(Result::WALLET_ERROR));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

886eed1: I think you don't need to do this static_cast, you can simply BOOST_CHECK(result == Result::WALLET_ERROR).

Comment thread src/wallet/test/feebumper_tests.cpp Outdated
LOCK2(cs_main, pool.cs);
for (int cluster = 0; cluster < 10; ++cluster) {
CTransactionRef last_tx = m_coinbase_txns.at(cluster);
const int chain_length = cluster == 0 ? 51 : 50; // 501 total txs across all clusters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

886eed1: The comment 501 total tx across all clusters explains what but not why. My suggestion is mentioning the limit from GatherClusters .

LOCK(wallet->cs_wallet);
for (const auto& tip_tx : tip_txs) {
wallet->AddToWallet(tip_tx, TxStateInactive{}, [](CWalletTx& wtx, bool /*new_tx*/) {
wtx.m_state = TxStateInactive{};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

886eed1: I think it can be simplified to wallet->AddToWallet(tip_tx, TxStateInactive{});.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for bump fee calculation failure in feebumper

5 participants