From a27a2957ed9afbe5a96caa5f0f4cbec730d27460 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 24 Oct 2019 11:35:42 -0400 Subject: [validation] Add CValidationState subclasses Split CValidationState into TxValidationState and BlockValidationState to store validation results for transactions and blocks respectively. --- src/node/transaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/node/transaction.cpp') diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 7783671a6..4645baa3d 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -36,7 +36,7 @@ TransactionError BroadcastTransaction(const CTransactionRef tx, std::string& err } if (!mempool.exists(hashTx)) { // Transaction is not already in the mempool. Submit it. - CValidationState state; + TxValidationState state; bool fMissingInputs; if (!AcceptToMemoryPool(mempool, state, std::move(tx), &fMissingInputs, nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) { -- cgit v1.2.3 From 3004d5a12d09d94bfc4dee2a8e8f2291996a4aaf Mon Sep 17 00:00:00 2001 From: John Newbery Date: Sun, 28 Apr 2019 16:26:31 -0500 Subject: [validation] Remove fMissingInputs from AcceptToMemoryPool() Handle this failure in the same way as all other failures: call Invalid() with the reasons for the failure. --- src/node/transaction.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/node/transaction.cpp') diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 4645baa3d..8989a77e5 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -37,17 +37,15 @@ TransactionError BroadcastTransaction(const CTransactionRef tx, std::string& err if (!mempool.exists(hashTx)) { // Transaction is not already in the mempool. Submit it. TxValidationState state; - bool fMissingInputs; - if (!AcceptToMemoryPool(mempool, state, std::move(tx), &fMissingInputs, + if (!AcceptToMemoryPool(mempool, state, std::move(tx), nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) { + err_string = FormatStateMessage(state); if (state.IsInvalid()) { - err_string = FormatStateMessage(state); - return TransactionError::MEMPOOL_REJECTED; - } else { - if (fMissingInputs) { + if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) { return TransactionError::MISSING_INPUTS; } - err_string = FormatStateMessage(state); + return TransactionError::MEMPOOL_REJECTED; + } else { return TransactionError::MEMPOOL_ERROR; } } -- cgit v1.2.3