From 50afdacd39f7422fcc196e541f883f46a56847c3 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 15 Jun 2023 16:43:28 +0200 Subject: [PATCH] wallet2: fixed a bug preventing PoS block creation when the UTXO defragmentation tx lacks decoy outputs --- src/wallet/wallet2.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 5d1ca212..e0da26fc 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6454,8 +6454,12 @@ bool wallet2::prepare_transaction(construct_tx_param& ctp, currency::finalize_tx TIME_MEASURE_START_MS(prepare_tx_sources_time); if (ctp.create_utxo_defragmentation_tx) { - if (!prepare_tx_sources_for_defragmentation_tx(ftp.sources, ftp.selected_transfers, needed_money_map[currency::native_coin_asset_id].found_amount)) - return false; + try + { + if (!prepare_tx_sources_for_defragmentation_tx(ftp.sources, ftp.selected_transfers, needed_money_map[currency::native_coin_asset_id].found_amount)) + return false; + } + catch(const error::not_enough_outs_to_mix&) { return false; } // if there's not enough decoys, return false to indicate minor non-fatal error } else if (ctp.htlc_tx_id != currency::null_hash) {