mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use the transaction master.
This commit is contained in:
@@ -26,7 +26,7 @@ uint32 NetworkOPs::getCurrentLedgerID()
|
|||||||
|
|
||||||
Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans, Peer* source)
|
Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans, Peer* source)
|
||||||
{
|
{
|
||||||
Transaction::pointer dbtx=Transaction::load(trans->getID());
|
Transaction::pointer dbtx=theApp->getMasterTransaction().fetch(trans->getID(), true);
|
||||||
if(dbtx) return dbtx;
|
if(dbtx) return dbtx;
|
||||||
|
|
||||||
if(!trans->checkSign())
|
if(!trans->checkSign())
|
||||||
@@ -47,7 +47,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
|
|||||||
std::cerr << "Transaction should be held" << std::endl;
|
std::cerr << "Transaction should be held" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
trans->setStatus(HELD);
|
trans->setStatus(HELD);
|
||||||
trans->save();
|
theApp->getMasterTransaction().canonicalize(trans, true);
|
||||||
theApp->getMasterLedger().addHeldTransaction(trans);
|
theApp->getMasterLedger().addHeldTransaction(trans);
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
|
|||||||
std::cerr << "Transaction is now included, synching to wallet" << std::endl;
|
std::cerr << "Transaction is now included, synching to wallet" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
trans->setStatus(INCLUDED);
|
trans->setStatus(INCLUDED);
|
||||||
|
theApp->getMasterTransaction().canonicalize(trans, true);
|
||||||
theApp->getWallet().applyTransaction(trans);
|
theApp->getWallet().applyTransaction(trans);
|
||||||
|
|
||||||
newcoin::TMTransaction *tx=new newcoin::TMTransaction();
|
newcoin::TMTransaction *tx=new newcoin::TMTransaction();
|
||||||
|
|||||||
@@ -428,9 +428,7 @@ Json::Value RPCServer::doTx(Json::Value& params)
|
|||||||
if(theApp->getWallet().getTxJson(txid, ret))
|
if(theApp->getWallet().getTxJson(txid, ret))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
Transaction::pointer txn=theApp->getMasterLedger().getCurrentLedger()->getTransaction(txid);
|
Transaction::pointer txn=theApp->getMasterTransaction().fetch(txid, true);
|
||||||
if(!txn) txn=theApp->getMasterLedger().getClosingLedger()->getTransaction(txid);
|
|
||||||
if(!txn) txn=Transaction::load(txid);
|
|
||||||
if(!txn) return JSONRPCError(500, "Transaction not found");
|
if(!txn) return JSONRPCError(500, "Transaction not found");
|
||||||
return txn->getJson(true);
|
return txn->getJson(true);
|
||||||
}
|
}
|
||||||
|
|||||||
24
TransactionMaster.h
Normal file
24
TransactionMaster.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef __TRANSACTIONMASTER__
|
||||||
|
#define __TRANSACTIONMASTER__
|
||||||
|
|
||||||
|
#include "Transaction.h"
|
||||||
|
#include "TaggedCache.h"
|
||||||
|
|
||||||
|
// Tracks all transactions in memory
|
||||||
|
|
||||||
|
class TransactionMaster
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
TaggedCache<uint256, Transaction> mCache;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TransactionMaster();
|
||||||
|
|
||||||
|
Transaction::pointer fetch(const uint256&, bool checkDisk);
|
||||||
|
|
||||||
|
// return value: true = we had the transaction already
|
||||||
|
bool canonicalize(Transaction::pointer& txn, bool maybeNew);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user