mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cache tid in STTx:
The digest for a transaction (its transaction ID, or tid) is computed once upon constructed when the STTx is deserialized. Subsequent calls to retrieve the digest use the cached value. Any code which modifies the STTx and then attempts to retrieve the digest will terminate the process with a logic error contract violation. * Nested types removed * All STTx are contained as const (Except in transaction sign, which must modify) * tid in STTx is computed once on deserialization
This commit is contained in:
@@ -155,7 +155,7 @@ public:
|
||||
//
|
||||
|
||||
// Must complete immediately.
|
||||
void submitTransaction (STTx::pointer) override;
|
||||
void submitTransaction (std::shared_ptr<STTx const> const&) override;
|
||||
|
||||
void processTransaction (
|
||||
Transaction::pointer& transaction,
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
void pubLedger (Ledger::ref lpAccepted) override;
|
||||
void pubProposedTransaction (
|
||||
std::shared_ptr<ReadView const> const& lpCurrent,
|
||||
STTx::ref stTxn, TER terResult) override;
|
||||
std::shared_ptr<STTx const> const& stTxn, TER terResult) override;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
@@ -639,7 +639,7 @@ std::string NetworkOPsImp::strOperatingMode () const
|
||||
return paStatusToken[mMode];
|
||||
}
|
||||
|
||||
void NetworkOPsImp::submitTransaction (STTx::pointer iTrans)
|
||||
void NetworkOPsImp::submitTransaction (std::shared_ptr<STTx const> const& iTrans)
|
||||
{
|
||||
if (isNeedNetworkLedger ())
|
||||
{
|
||||
@@ -648,11 +648,7 @@ void NetworkOPsImp::submitTransaction (STTx::pointer iTrans)
|
||||
}
|
||||
|
||||
// this is an asynchronous interface
|
||||
Serializer s;
|
||||
iTrans->add (s);
|
||||
|
||||
SerialIter sit (s.slice());
|
||||
auto trans = std::make_shared<STTx> (std::ref (sit));
|
||||
auto const trans = sterilize(*iTrans);
|
||||
|
||||
auto const txid = trans->getTransactionID ();
|
||||
auto const flags = app_.getHashRouter().getFlags(txid);
|
||||
@@ -2005,7 +2001,7 @@ Json::Value NetworkOPsImp::getLedgerFetchInfo ()
|
||||
|
||||
void NetworkOPsImp::pubProposedTransaction (
|
||||
std::shared_ptr<ReadView const> const& lpCurrent,
|
||||
STTx::ref stTxn, TER terResult)
|
||||
std::shared_ptr<STTx const> const& stTxn, TER terResult)
|
||||
{
|
||||
Json::Value jvObj = transJson (*stTxn, terResult, false, lpCurrent);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
//
|
||||
|
||||
// must complete immediately
|
||||
virtual void submitTransaction (STTx::pointer) = 0;
|
||||
virtual void submitTransaction (std::shared_ptr<STTx const> const&) = 0;
|
||||
|
||||
/**
|
||||
* Process transactions as they arrive from the network or which are
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
virtual void pubLedger (Ledger::ref lpAccepted) = 0;
|
||||
virtual void pubProposedTransaction (
|
||||
std::shared_ptr<ReadView const> const& lpCurrent,
|
||||
STTx::ref stTxn, TER terResult) = 0;
|
||||
std::shared_ptr<STTx const> const& stTxn, TER terResult) = 0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,7 +40,7 @@ convertBlobsToTxResult (
|
||||
Application& app)
|
||||
{
|
||||
SerialIter it (makeSlice(rawTxn));
|
||||
STTx::pointer txn = std::make_shared<STTx> (it);
|
||||
auto txn = std::make_shared<STTx const> (it);
|
||||
std::string reason;
|
||||
|
||||
auto tr = std::make_shared<Transaction> (txn, reason, app);
|
||||
|
||||
Reference in New Issue
Block a user