mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Pass by reference in processTransaction
This commit is contained in:
committed by
Vinnie Falco
parent
d8d51e8103
commit
de6f678de7
@@ -213,7 +213,7 @@ public:
|
|||||||
void submitTransaction (Job&, STTx::pointer) override;
|
void submitTransaction (Job&, STTx::pointer) override;
|
||||||
|
|
||||||
void processTransaction (
|
void processTransaction (
|
||||||
Transaction::pointer transaction,
|
Transaction::pointer& transaction,
|
||||||
bool bAdmin, bool bLocal, FailHard failType) override;
|
bool bAdmin, bool bLocal, FailHard failType) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -858,7 +858,7 @@ void NetworkOPsImp::submitTransaction (Job&, STTx::pointer iTrans)
|
|||||||
FailHard::no));
|
FailHard::no));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPsImp::processTransaction (Transaction::pointer transaction,
|
void NetworkOPsImp::processTransaction (Transaction::pointer& transaction,
|
||||||
bool bAdmin, bool bLocal, FailHard failType)
|
bool bAdmin, bool bLocal, FailHard failType)
|
||||||
{
|
{
|
||||||
auto ev = m_job_queue.getLoadEventAP (jtTXN_PROC, "ProcessTXN");
|
auto ev = m_job_queue.getLoadEventAP (jtTXN_PROC, "ProcessTXN");
|
||||||
@@ -1105,7 +1105,6 @@ void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
|
|||||||
// transaction should be held
|
// transaction should be held
|
||||||
m_journal.debug << "Transaction should be held: " << e.result;
|
m_journal.debug << "Transaction should be held: " << e.result;
|
||||||
e.transaction->setStatus (HELD);
|
e.transaction->setStatus (HELD);
|
||||||
getApp().getMasterTransaction().canonicalize (&e.transaction);
|
|
||||||
m_ledgerMaster.addHeldTransaction (e.transaction);
|
m_ledgerMaster.addHeldTransaction (e.transaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public:
|
|||||||
* @param bLocal Client submission.
|
* @param bLocal Client submission.
|
||||||
* @param failType fail_hard setting from transaction 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;
|
bool bAdmin, bool bLocal, FailHard failType) = 0;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
// return value: true = we had the transaction already
|
// return value: true = we had the transaction already
|
||||||
bool inLedger (uint256 const& hash, std::uint32_t ledger);
|
bool inLedger (uint256 const& hash, std::uint32_t ledger);
|
||||||
bool canonicalize (Transaction::pointer* pTransaction);
|
void canonicalize (Transaction::pointer* pTransaction);
|
||||||
void sweep (void);
|
void sweep (void);
|
||||||
TaggedCache <uint256, Transaction>& getCache();
|
TaggedCache <uint256, Transaction>& getCache();
|
||||||
|
|
||||||
|
|||||||
@@ -91,25 +91,17 @@ STTx::pointer TransactionMaster::fetch (std::shared_ptr<SHAMapItem> const& item,
|
|||||||
return txn;
|
return txn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TransactionMaster::canonicalize (Transaction::pointer* pTransaction)
|
void
|
||||||
|
TransactionMaster::canonicalize(Transaction::pointer* pTransaction)
|
||||||
{
|
{
|
||||||
Transaction::pointer txn (*pTransaction);
|
uint256 const tid = (*pTransaction)->getID();
|
||||||
|
if (tid != zero)
|
||||||
uint256 tid = txn->getID ();
|
|
||||||
|
|
||||||
if (!tid)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// VFALCO NOTE canonicalize can change the value of txn!
|
|
||||||
if (mCache.canonicalize (tid, txn))
|
|
||||||
{
|
{
|
||||||
|
Transaction::pointer txn(*pTransaction);
|
||||||
|
// VFALCO NOTE canonicalize can change the value of txn!
|
||||||
|
mCache.canonicalize(tid, txn);
|
||||||
*pTransaction = 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)
|
void TransactionMaster::sweep (void)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ std::uint32_t TxnSignApiFacade::getSeq () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TxnSignApiFacade::processTransaction (
|
void TxnSignApiFacade::processTransaction (
|
||||||
Transaction::ref tpTrans,
|
Transaction::pointer& transaction,
|
||||||
bool bAdmin,
|
bool bAdmin,
|
||||||
bool bLocal,
|
bool bLocal,
|
||||||
NetworkOPs::FailHard failType)
|
NetworkOPs::FailHard failType)
|
||||||
@@ -140,7 +140,7 @@ void TxnSignApiFacade::processTransaction (
|
|||||||
if (!netOPs_) // Unit testing.
|
if (!netOPs_) // Unit testing.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
netOPs_->processTransaction (tpTrans, bAdmin, bLocal, failType);
|
netOPs_->processTransaction(transaction, bAdmin, bLocal, failType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TxnSignApiFacade::findPathsForOneIssuer (
|
bool TxnSignApiFacade::findPathsForOneIssuer (
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
STPath& fullLiquidityPath) const;
|
STPath& fullLiquidityPath) const;
|
||||||
|
|
||||||
void processTransaction (
|
void processTransaction (
|
||||||
Transaction::ref tpTrans,
|
Transaction::pointer& transaction,
|
||||||
bool bAdmin,
|
bool bAdmin,
|
||||||
bool bLocal,
|
bool bLocal,
|
||||||
NetworkOPs::FailHard failType);
|
NetworkOPs::FailHard failType);
|
||||||
|
|||||||
Reference in New Issue
Block a user