aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/spend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/spend.cpp')
-rw-r--r--src/wallet/spend.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 5771d33b7a..ea910bd5b8 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -917,6 +917,12 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
const CAmount not_input_fees = coin_selection_params.m_effective_feerate.GetFee(coin_selection_params.m_subtract_fee_outputs ? 0 : coin_selection_params.tx_noinputs_size);
CAmount selection_target = recipients_sum + not_input_fees;
+ // This can only happen if feerate is 0, and requested destinations are value of 0 (e.g. OP_RETURN)
+ // and no pre-selected inputs. This will result in 0-input transaction, which is consensus-invalid anyways
+ if (selection_target == 0 && !coin_control.HasSelected()) {
+ return util::Error{_("Transaction requires one destination of non-0 value, a non-0 feerate, or a pre-selected input")};
+ }
+
// Fetch manually selected coins
PreSelectedInputs preset_inputs;
if (coin_control.HasSelected()) {