Skip to content
Bitcoin Roots

v29.4-roots.2 · Commit 4: [PATCH 04/21] wallet: harden database and signing behavior

src/wallet/spend.cpp

Before: src/wallet/spend.cpp · After: src/wallet/spend.cpp

File metadata
index 26924d635265aba0369c389b2deabaca5454e993..3292ae27976c7cc7328426b35c5163c00c43160e 100644

Download original patch · Release notes

Diff rows 1–16 of 16. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/wallet/spend.cpp CHANGED
@@ -758,7 +758,7 @@ util::Result<SelectionResult> ChooseSelectionResult(interfaces::Chain& chain, co
758
  }
759
  std::optional<CAmount> combined_bump_fee = chain.calculateCombinedBumpFee(outpoints, coin_selection_params.m_effective_feerate);
760
  if (!combined_bump_fee.has_value()) {
761
- return util::Error{_("Failed to calculate bump fees, because unconfirmed UTXOs depend on enormous cluster of unconfirmed transactions.")};
762
  }
763
  CAmount bump_fee_overestimate = summed_bump_fees - combined_bump_fee.value();
764
  if (bump_fee_overestimate) {
@@ -888,7 +888,7 @@ util::Result<SelectionResult> AutomaticCoinSelection(const CWallet& wallet, Coin
888
  if (group.m_ancestors >= max_ancestors || group.m_descendants >= max_descendants) total_unconf_long_chain += group.GetSelectionAmount();
889
  }
890
 
891
- if (CAmount total_amount = available_coins.GetTotalAmount() - total_discarded < value_to_select) {
892
  // Special case, too-long-mempool cluster.
893
  if (total_amount + total_unconf_long_chain > value_to_select) {
894
  return util::Error{_("Unconfirmed UTXOs are available, but spending them creates a chain of transactions that will be rejected by the mempool")};
 
758
  }
759
  std::optional<CAmount> combined_bump_fee = chain.calculateCombinedBumpFee(outpoints, coin_selection_params.m_effective_feerate);
760
  if (!combined_bump_fee.has_value()) {
761
+ return util::Error{_("Failed to calculate bump fees, because unconfirmed UTXOs depend on an enormous cluster of unconfirmed transactions.")};
762
  }
763
  CAmount bump_fee_overestimate = summed_bump_fees - combined_bump_fee.value();
764
  if (bump_fee_overestimate) {
 
888
  if (group.m_ancestors >= max_ancestors || group.m_descendants >= max_descendants) total_unconf_long_chain += group.GetSelectionAmount();
889
  }
890
 
891
+ if (CAmount total_amount = available_coins.GetTotalAmount() - total_discarded; total_amount < value_to_select) {
892
  // Special case, too-long-mempool cluster.
893
  if (total_amount + total_unconf_long_chain > value_to_select) {
894
  return util::Error{_("Unconfirmed UTXOs are available, but spending them creates a chain of transactions that will be rejected by the mempool")};