Changeset View
Changeset View
Standalone View
Standalone View
src/node/transaction.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | bool callback_set = false; | ||||
} | } | ||||
} | } | ||||
if (!node.mempool->exists(txid)) { | if (!node.mempool->exists(txid)) { | ||||
// Transaction is not already in the mempool. | // Transaction is not already in the mempool. | ||||
if (max_tx_fee > Amount::zero()) { | if (max_tx_fee > Amount::zero()) { | ||||
// 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. | ||||
const MempoolAcceptResult result = AcceptToMemoryPool( | const MempoolAcceptResult result = | ||||
node.chainman->ActiveChainstate(), config, *node.mempool, | node.chainman->ProcessTransaction(tx, /*test_accept=*/true); | ||||
tx, false /* bypass_limits */, | |||||
/* test_accept */ true); | |||||
if (result.m_result_type != | if (result.m_result_type != | ||||
MempoolAcceptResult::ResultType::VALID) { | MempoolAcceptResult::ResultType::VALID) { | ||||
return HandleATMPError(result.m_state, err_string); | return HandleATMPError(result.m_state, err_string); | ||||
} else if (result.m_base_fees.value() > max_tx_fee) { | } else if (result.m_base_fees.value() > max_tx_fee) { | ||||
return TransactionError::MAX_FEE_EXCEEDED; | return TransactionError::MAX_FEE_EXCEEDED; | ||||
} | } | ||||
} | } | ||||
// Try to submit the transaction to the mempool. | // Try to submit the transaction to the mempool. | ||||
const MempoolAcceptResult result = AcceptToMemoryPool( | const MempoolAcceptResult result = | ||||
node.chainman->ActiveChainstate(), config, *node.mempool, tx, | node.chainman->ProcessTransaction(tx, /*test_accept=*/false); | ||||
false /* bypass_limits */); | |||||
if (result.m_result_type != | if (result.m_result_type != | ||||
MempoolAcceptResult::ResultType::VALID) { | MempoolAcceptResult::ResultType::VALID) { | ||||
return HandleATMPError(result.m_state, err_string); | return HandleATMPError(result.m_state, err_string); | ||||
} | } | ||||
// Transaction was accepted to the mempool. | // Transaction was accepted to the mempool. | ||||
if (relay) { | if (relay) { | ||||
Show All 33 Lines |