aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgzhao408 <gzhao408@berkeley.edu>2020-10-08 14:10:43 -0700
committergzhao408 <gzhao408@berkeley.edu>2020-10-08 14:11:16 -0700
commitc201d73df3602dac75573a0ec3fe4c86bbc02585 (patch)
treee6e3f5eda3835706b6ab4f9adf6406328a0055ea
parentb337bd7bc0873ace317ad8e1ebbd3842da3f81d5 (diff)
downloadbitcoin-c201d73df3602dac75573a0ec3fe4c86bbc02585.tar.xz
style and nits for fee-checking in BroadcastTransaction
-rw-r--r--src/node/transaction.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp
index b72f7b70e9..97d5aad8e4 100644
--- a/src/node/transaction.cpp
+++ b/src/node/transaction.cpp
@@ -13,7 +13,8 @@
#include <future>
-static TransactionError HandleATMPError(const TxValidationState& state, std::string& err_string_out) {
+static TransactionError HandleATMPError(const TxValidationState& state, std::string& err_string_out)
+{
err_string_out = state.ToString();
if (state.IsInvalid()) {
if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) {
@@ -50,10 +51,10 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
if (!node.mempool->exists(hashTx)) {
// Transaction is not already in the mempool.
TxValidationState state;
- CAmount fee{0};
- if (max_tx_fee) {
+ if (max_tx_fee > 0) {
// First, call ATMP with test_accept and check the fee. If ATMP
// fails here, return error immediately.
+ CAmount fee{0};
if (!AcceptToMemoryPool(*node.mempool, state, tx,
nullptr /* plTxnReplaced */, false /* bypass_limits */, /* test_accept */ true, &fee)) {
return HandleATMPError(state, err_string);