mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Reformatting using AStyle
This commit is contained in:
@@ -7,82 +7,87 @@
|
||||
#define CACHED_TRANSACTION_AGE 1800
|
||||
#endif
|
||||
|
||||
TransactionMaster::TransactionMaster() : mCache("TransactionCache", CACHED_TRANSACTION_NUM, CACHED_TRANSACTION_AGE)
|
||||
TransactionMaster::TransactionMaster () : mCache ("TransactionCache", CACHED_TRANSACTION_NUM, CACHED_TRANSACTION_AGE)
|
||||
{
|
||||
;
|
||||
;
|
||||
}
|
||||
|
||||
bool TransactionMaster::inLedger(uint256 const& hash, uint32 ledger)
|
||||
bool TransactionMaster::inLedger (uint256 const& hash, uint32 ledger)
|
||||
{
|
||||
Transaction::pointer txn = mCache.fetch(hash);
|
||||
if (!txn)
|
||||
return false;
|
||||
txn->setStatus(COMMITTED, ledger);
|
||||
return true;
|
||||
Transaction::pointer txn = mCache.fetch (hash);
|
||||
|
||||
if (!txn)
|
||||
return false;
|
||||
|
||||
txn->setStatus (COMMITTED, ledger);
|
||||
return true;
|
||||
}
|
||||
|
||||
Transaction::pointer TransactionMaster::fetch(uint256 const& txnID, bool checkDisk)
|
||||
Transaction::pointer TransactionMaster::fetch (uint256 const& txnID, bool checkDisk)
|
||||
{
|
||||
Transaction::pointer txn = mCache.fetch(txnID);
|
||||
if (!checkDisk || txn)
|
||||
return txn;
|
||||
Transaction::pointer txn = mCache.fetch (txnID);
|
||||
|
||||
txn = Transaction::load(txnID);
|
||||
if (!txn)
|
||||
return txn;
|
||||
if (!checkDisk || txn)
|
||||
return txn;
|
||||
|
||||
mCache.canonicalize(txnID, txn);
|
||||
txn = Transaction::load (txnID);
|
||||
|
||||
return txn;
|
||||
if (!txn)
|
||||
return txn;
|
||||
|
||||
mCache.canonicalize (txnID, txn);
|
||||
|
||||
return txn;
|
||||
}
|
||||
|
||||
SerializedTransaction::pointer TransactionMaster::fetch(SHAMapItem::ref item, SHAMapTreeNode::TNType type,
|
||||
bool checkDisk, uint32 uCommitLedger)
|
||||
SerializedTransaction::pointer TransactionMaster::fetch (SHAMapItem::ref item, SHAMapTreeNode::TNType type,
|
||||
bool checkDisk, uint32 uCommitLedger)
|
||||
{
|
||||
SerializedTransaction::pointer txn;
|
||||
Transaction::pointer iTx = theApp->getMasterTransaction().fetch(item->getTag(), false);
|
||||
SerializedTransaction::pointer txn;
|
||||
Transaction::pointer iTx = theApp->getMasterTransaction ().fetch (item->getTag (), false);
|
||||
|
||||
if (!iTx)
|
||||
{
|
||||
if (!iTx)
|
||||
{
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
SerializerIterator sit(item->peekSerializer());
|
||||
txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
Serializer s;
|
||||
int length;
|
||||
item->peekSerializer().getVL(s.modData(), 0, length);
|
||||
SerializerIterator sit(s);
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
SerializerIterator sit (item->peekSerializer ());
|
||||
txn = boost::make_shared<SerializedTransaction> (boost::ref (sit));
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
Serializer s;
|
||||
int length;
|
||||
item->peekSerializer ().getVL (s.modData (), 0, length);
|
||||
SerializerIterator sit (s);
|
||||
|
||||
txn = boost::make_shared<SerializedTransaction>(boost::ref(sit));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uCommitLedger)
|
||||
iTx->setStatus(COMMITTED, uCommitLedger);
|
||||
txn = boost::make_shared<SerializedTransaction> (boost::ref (sit));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uCommitLedger)
|
||||
iTx->setStatus (COMMITTED, uCommitLedger);
|
||||
|
||||
txn = iTx->getSTransaction();
|
||||
}
|
||||
txn = iTx->getSTransaction ();
|
||||
}
|
||||
|
||||
return txn;
|
||||
return txn;
|
||||
}
|
||||
|
||||
bool TransactionMaster::canonicalize(Transaction::pointer& txn, bool may_be_new)
|
||||
bool TransactionMaster::canonicalize (Transaction::pointer& txn, bool may_be_new)
|
||||
{
|
||||
uint256 tid = txn->getID();
|
||||
if (!tid)
|
||||
return false;
|
||||
uint256 tid = txn->getID ();
|
||||
|
||||
if (mCache.canonicalize(tid, txn))
|
||||
return true;
|
||||
if (!tid)
|
||||
return false;
|
||||
|
||||
if (may_be_new)
|
||||
txn->save();
|
||||
if (mCache.canonicalize (tid, txn))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
if (may_be_new)
|
||||
txn->save ();
|
||||
|
||||
return false;
|
||||
}
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user