From ad2067cb3f1dddca0ee82169ae513772c37be5ae Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 11 Oct 2023 17:05:20 +0200 Subject: [PATCH] temporary debug logging --- src/currency_core/currency_format_utils.cpp | 8 +++++--- src/wallet/wallet2.cpp | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 4a9be162..a9e01814 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -36,7 +36,8 @@ using namespace epee; #include "wallet/wallet_debug_events_definitions.h" -#define DBG_VAL_PRINT(x) ((void)0) // LOG_PRINT_CYAN(std::setw(42) << std::left << #x ":" << x, LOG_LEVEL_0) +//#define DBG_VAL_PRINT(x) ((void)0) +#define DBG_VAL_PRINT(x) LOG_PRINT_CYAN(std::setw(42) << std::left << #x ":" << x, LOG_LEVEL_0) namespace currency { @@ -312,6 +313,7 @@ namespace currency crypto::point_t commitment_to_zero = (crypto::scalar_t(bare_inputs_sum) - crypto::scalar_t(fee)) * currency::native_coin_asset_id_pt + ogc.pseudo_out_amount_commitments_sum + (ogc.ao_commitment_in_outputs ? -ogc.ao_amount_commitment : ogc.ao_amount_commitment) - ogc.amount_commitments_sum; crypto::scalar_t secret_x = ogc.real_in_asset_id_blinding_mask_x_amount_sum - ogc.asset_id_blinding_mask_x_amount_sum; + DBG_VAL_PRINT("==generate_tx_balance_proof (X)=="); DBG_VAL_PRINT(bare_inputs_sum); DBG_VAL_PRINT(fee); DBG_VAL_PRINT(ogc.pseudo_out_amount_commitments_sum); @@ -323,10 +325,10 @@ namespace currency DBG_VAL_PRINT(commitment_to_zero); DBG_VAL_PRINT(secret_x); -#ifndef NDEBUG +//#ifndef NDEBUG bool commitment_to_zero_is_sane = commitment_to_zero == secret_x * crypto::c_point_X; CHECK_AND_ASSERT_MES(commitment_to_zero_is_sane, false, "internal error: commitment_to_zero is malformed (X)"); -#endif +//#endif r = crypto::generate_schnorr_sig(tx_id, commitment_to_zero, secret_x, proof.ss); CHECK_AND_ASSERT_MES(r, false, "generate_schnorr_sig (X) failed"); } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a2283c54..deb84a17 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6814,6 +6814,12 @@ void wallet2::finalize_transaction(const currency::finalize_tx_param& ftp, curre // broadcasting tx without secret key storing is forbidden to avoid lost key issues WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(!broadcast_tx || store_tx_secret_key, "finalize_tx is requested to broadcast a tx without storing the key"); + std::string filename = std::string("ftp_") + epee::string_tools::int_to_hex(crypto::rand()).substr(2); + std::string ftp_serialized; + WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(t_serializable_object_to_blob(ftp, ftp_serialized), "t_serializable_object_to_blob(ftp) failed"); + epee::file_io_utils::save_string_to_file_throw(filename, ftp_serialized); + LOG_PRINT_L0("finalize tx params were serialized to: " << filename); + //TIME_MEASURE_START_MS(construct_tx_time); bool r = currency::construct_tx(m_account.get_keys(), ftp, result);