1
0
Fork 0
forked from lthn/blockchain

wallet: introduced upper limit for tx fee (soft rule)

This commit is contained in:
sowle 2024-02-22 18:19:15 +01:00
parent d8a21933d6
commit ec77e14ead
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -58,6 +58,8 @@ using namespace currency;
#define WALLET_MIN_UTXO_COUNT_FOR_DEFRAGMENTATION_TX 3 // TODO: @#@# consider descreasing to mimic normal tx
#define WALLET_MAX_UTXO_COUNT_FOR_DEFRAGMENTATION_TX 10 // TODO: @#@# consider descreasing to mimic normal tx
#define WALLET_TX_MAX_ALLOWED_FEE (COIN * 100)
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "wallet"
ENABLE_CHANNEL_BY_DEFAULT("wallet")
@ -7125,6 +7127,8 @@ void wallet2::finalize_transaction(currency::finalize_tx_param& ftp, currency::f
ftp, result);
//TIME_MEASURE_FINISH_MS(construct_tx_time);
THROW_IF_FALSE_WALLET_EX(r, error::tx_not_constructed, ftp.sources, ftp.prepared_destinations, ftp.unlock_time);
uint64_t effective_fee = get_tx_fee(result.tx);
THROW_IF_FALSE_WALLET_CMN_ERR_EX(effective_fee <= WALLET_TX_MAX_ALLOWED_FEE, "tx fee is WAY too big: " << print_money_brief(effective_fee) << ", max allowed is " << print_money_brief(WALLET_TX_MAX_ALLOWED_FEE));
//TIME_MEASURE_START_MS(sign_ms_input_time);
if (ftp.multisig_id != currency::null_hash)