mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
style and nits for fee-checking in BroadcastTransaction
This commit is contained in:
parent
b337bd7bc0
commit
c201d73df3
1 changed files with 4 additions and 3 deletions
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
#include <future>
|
#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();
|
err_string_out = state.ToString();
|
||||||
if (state.IsInvalid()) {
|
if (state.IsInvalid()) {
|
||||||
if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) {
|
if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) {
|
||||||
|
@ -50,10 +51,10 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||||
if (!node.mempool->exists(hashTx)) {
|
if (!node.mempool->exists(hashTx)) {
|
||||||
// Transaction is not already in the mempool.
|
// Transaction is not already in the mempool.
|
||||||
TxValidationState state;
|
TxValidationState state;
|
||||||
CAmount fee{0};
|
if (max_tx_fee > 0) {
|
||||||
if (max_tx_fee) {
|
|
||||||
// First, call ATMP with test_accept and check the fee. If ATMP
|
// First, call ATMP with test_accept and check the fee. If ATMP
|
||||||
// fails here, return error immediately.
|
// fails here, return error immediately.
|
||||||
|
CAmount fee{0};
|
||||||
if (!AcceptToMemoryPool(*node.mempool, state, tx,
|
if (!AcceptToMemoryPool(*node.mempool, state, tx,
|
||||||
nullptr /* plTxnReplaced */, false /* bypass_limits */, /* test_accept */ true, &fee)) {
|
nullptr /* plTxnReplaced */, false /* bypass_limits */, /* test_accept */ true, &fee)) {
|
||||||
return HandleATMPError(state, err_string);
|
return HandleATMPError(state, err_string);
|
||||||
|
|
Loading…
Add table
Reference in a new issue