Changeset View
Changeset View
Standalone View
Standalone View
src/node/transaction.cpp
// Copyright (c) 2010 Satoshi Nakamoto | // Copyright (c) 2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2018 The Bitcoin Core developers | // Copyright (c) 2009-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <node/transaction.h> | #include <node/transaction.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <net_processing.h> | #include <net_processing.h> | ||||
#include <node/context.h> | #include <node/context.h> | ||||
#include <primitives/txid.h> | #include <primitives/txid.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <util/validation.h> | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <future> | #include <future> | ||||
TransactionError BroadcastTransaction(NodeContext &node, const Config &config, | TransactionError BroadcastTransaction(NodeContext &node, const Config &config, | ||||
const CTransactionRef tx, | const CTransactionRef tx, | ||||
std::string &err_string, | std::string &err_string, | ||||
Show All 24 Lines | bool callback_set = false; | ||||
} | } | ||||
} | } | ||||
if (!node.mempool->exists(txid)) { | if (!node.mempool->exists(txid)) { | ||||
// Transaction is not already in the mempool. Submit it. | // Transaction is not already in the mempool. Submit it. | ||||
TxValidationState state; | TxValidationState state; | ||||
if (!AcceptToMemoryPool(config, *node.mempool, state, std::move(tx), | if (!AcceptToMemoryPool(config, *node.mempool, state, std::move(tx), | ||||
false /* bypass_limits */, max_tx_fee)) { | false /* bypass_limits */, max_tx_fee)) { | ||||
err_string = FormatStateMessage(state); | err_string = state.ToString(); | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
if (state.GetResult() == | if (state.GetResult() == | ||||
TxValidationResult::TX_MISSING_INPUTS) { | TxValidationResult::TX_MISSING_INPUTS) { | ||||
return TransactionError::MISSING_INPUTS; | return TransactionError::MISSING_INPUTS; | ||||
} | } | ||||
return TransactionError::MEMPOOL_REJECTED; | return TransactionError::MEMPOOL_REJECTED; | ||||
} | } | ||||
return TransactionError::MEMPOOL_ERROR; | return TransactionError::MEMPOOL_ERROR; | ||||
Show All 32 Lines |