diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 74f3189ba0..3445f2125e 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -213,7 +213,7 @@ public: void submitTransaction (Job&, STTx::pointer) override; void processTransaction ( - Transaction::pointer transaction, + Transaction::pointer& transaction, bool bAdmin, bool bLocal, FailHard failType) override; /** @@ -858,7 +858,7 @@ void NetworkOPsImp::submitTransaction (Job&, STTx::pointer iTrans) FailHard::no)); } -void NetworkOPsImp::processTransaction (Transaction::pointer transaction, +void NetworkOPsImp::processTransaction (Transaction::pointer& transaction, bool bAdmin, bool bLocal, FailHard failType) { auto ev = m_job_queue.getLoadEventAP (jtTXN_PROC, "ProcessTXN"); @@ -1105,7 +1105,6 @@ void NetworkOPsImp::apply (std::unique_lock& batchLock) // transaction should be held m_journal.debug << "Transaction should be held: " << e.result; e.transaction->setStatus (HELD); - getApp().getMasterTransaction().canonicalize (&e.transaction); m_ledgerMaster.addHeldTransaction (e.transaction); } } diff --git a/src/ripple/app/misc/NetworkOPs.h b/src/ripple/app/misc/NetworkOPs.h index c56032ff97..2f9e899953 100644 --- a/src/ripple/app/misc/NetworkOPs.h +++ b/src/ripple/app/misc/NetworkOPs.h @@ -143,7 +143,7 @@ public: * @param bLocal Client submission. * @param failType fail_hard setting from transaction submission. */ - virtual void processTransaction (Transaction::pointer transaction, + virtual void processTransaction (Transaction::pointer& transaction, bool bAdmin, bool bLocal, FailHard failType) = 0; //-------------------------------------------------------------------------- diff --git a/src/ripple/app/tx/TransactionMaster.h b/src/ripple/app/tx/TransactionMaster.h index 140ff9a16f..ee16b78e2e 100644 --- a/src/ripple/app/tx/TransactionMaster.h +++ b/src/ripple/app/tx/TransactionMaster.h @@ -39,7 +39,7 @@ public: // return value: true = we had the transaction already bool inLedger (uint256 const& hash, std::uint32_t ledger); - bool canonicalize (Transaction::pointer* pTransaction); + void canonicalize (Transaction::pointer* pTransaction); void sweep (void); TaggedCache & getCache(); diff --git a/src/ripple/app/tx/impl/TransactionMaster.cpp b/src/ripple/app/tx/impl/TransactionMaster.cpp index f485c339f0..e193e35b16 100644 --- a/src/ripple/app/tx/impl/TransactionMaster.cpp +++ b/src/ripple/app/tx/impl/TransactionMaster.cpp @@ -91,25 +91,17 @@ STTx::pointer TransactionMaster::fetch (std::shared_ptr const& item, return txn; } -bool TransactionMaster::canonicalize (Transaction::pointer* pTransaction) +void +TransactionMaster::canonicalize(Transaction::pointer* pTransaction) { - Transaction::pointer txn (*pTransaction); - - uint256 tid = txn->getID (); - - if (!tid) - return false; - - // VFALCO NOTE canonicalize can change the value of txn! - if (mCache.canonicalize (tid, txn)) + uint256 const tid = (*pTransaction)->getID(); + if (tid != zero) { + Transaction::pointer txn(*pTransaction); + // VFALCO NOTE canonicalize can change the value of txn! + mCache.canonicalize(tid, txn); *pTransaction = txn; - return true; } - - // VFALCO NOTE I am unsure if this is necessary but better safe than sorry. - *pTransaction = txn; - return false; } void TransactionMaster::sweep (void) diff --git a/src/ripple/rpc/impl/TransactionSign.cpp b/src/ripple/rpc/impl/TransactionSign.cpp index 371ce97fbf..0766916693 100644 --- a/src/ripple/rpc/impl/TransactionSign.cpp +++ b/src/ripple/rpc/impl/TransactionSign.cpp @@ -132,7 +132,7 @@ std::uint32_t TxnSignApiFacade::getSeq () const } void TxnSignApiFacade::processTransaction ( - Transaction::ref tpTrans, + Transaction::pointer& transaction, bool bAdmin, bool bLocal, NetworkOPs::FailHard failType) @@ -140,7 +140,7 @@ void TxnSignApiFacade::processTransaction ( if (!netOPs_) // Unit testing. return; - netOPs_->processTransaction (tpTrans, bAdmin, bLocal, failType); + netOPs_->processTransaction(transaction, bAdmin, bLocal, failType); } bool TxnSignApiFacade::findPathsForOneIssuer ( diff --git a/src/ripple/rpc/impl/TransactionSign.h b/src/ripple/rpc/impl/TransactionSign.h index 6ae4679838..8cf6a348e5 100644 --- a/src/ripple/rpc/impl/TransactionSign.h +++ b/src/ripple/rpc/impl/TransactionSign.h @@ -76,7 +76,7 @@ public: STPath& fullLiquidityPath) const; void processTransaction ( - Transaction::ref tpTrans, + Transaction::pointer& transaction, bool bAdmin, bool bLocal, NetworkOPs::FailHard failType);