From 399921347fd5b4ceaecd52484fb8f470cdb9ef03 Mon Sep 17 00:00:00 2001 From: Leon Klingele Date: Tue, 30 Jan 2018 16:16:20 +0100 Subject: [PATCH] txpool: Properly bail out when outputs_amount == inputs_amount Previously, when outputs_amount == inputs_amount, the "m_overspend" property was set, whereas "m_fee_too_low" would have been the correct property to set. This is unlikely to ever occur and just something I've noticed while reading through the code. --- src/cryptonote_core/tx_pool.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index e75584bce..f6c054c0a 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -151,13 +151,20 @@ namespace cryptonote } uint64_t outputs_amount = get_outs_money_amount(tx); - if(outputs_amount >= inputs_amount) + if(outputs_amount > inputs_amount) { LOG_PRINT_L1("transaction use more money then it has: use " << print_money(outputs_amount) << ", have " << print_money(inputs_amount)); tvc.m_verifivation_failed = true; tvc.m_overspend = true; return false; } + else if(outputs_amount == inputs_amount) + { + LOG_PRINT_L1("transaction fee is zero: outputs_amount == inputs_amount, rejecting."); + tvc.m_verifivation_failed = true; + tvc.m_fee_too_low = true; + return false; + } fee = inputs_amount - outputs_amount; }