mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
wallet: notify when preset + automatic inputs exceed max weight
This also avoids signing all inputs prior to erroring out.
This commit is contained in:
@@ -799,6 +799,13 @@ util::Result<SelectionResult> SelectCoins(const CWallet& wallet, CoinsResult& av
|
||||
op_selection_result->RecalculateWaste(coin_selection_params.min_viable_change,
|
||||
coin_selection_params.m_cost_of_change,
|
||||
coin_selection_params.m_change_fee);
|
||||
|
||||
// Verify we haven't exceeded the maximum allowed weight
|
||||
int max_inputs_weight = MAX_STANDARD_TX_WEIGHT - (coin_selection_params.tx_noinputs_size * WITNESS_SCALE_FACTOR);
|
||||
if (op_selection_result->GetWeight() > max_inputs_weight) {
|
||||
return util::Error{_("The combination of the pre-selected inputs and the wallet automatic inputs selection exceeds the transaction maximum weight. "
|
||||
"Please try sending a smaller amount or manually consolidating your wallet's UTXOs")};
|
||||
}
|
||||
}
|
||||
return op_selection_result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user