mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Refactor Serializer, SerialIter, SHAMapItem, NodeObject:
* Make LessThan private * Make NodeObject::isSame private * Remove hotTRANSACTION * Remove some Serializer members * Remove unused SHAMapItem::getRaw * Remove unused STLedgerEntry::getOwners * Remove Serializer constructors * Remove unused Serializer members * Remove SerialIter ctor
This commit is contained in:
@@ -410,7 +410,7 @@ Transaction::pointer Ledger::getTransaction (uint256 const& transID) const
|
||||
Blob txnData;
|
||||
int txnLength;
|
||||
|
||||
if (!item->peekSerializer ().getVL (txnData, 0, txnLength))
|
||||
if (!item->peekSerializer().getVL (txnData, 0, txnLength))
|
||||
return Transaction::pointer ();
|
||||
|
||||
txn = Transaction::sharedTransaction (txnData, Validate::NO);
|
||||
@@ -431,15 +431,16 @@ Transaction::pointer Ledger::getTransaction (uint256 const& transID) const
|
||||
STTx::pointer Ledger::getSTransaction (
|
||||
std::shared_ptr<SHAMapItem> const& item, SHAMapTreeNode::TNType type)
|
||||
{
|
||||
SerialIter sit (item->peekSerializer ());
|
||||
SerialIter sit (item->slice());
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
return std::make_shared<STTx> (sit);
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
Serializer sTxn (sit.getVL ());
|
||||
SerialIter tSit (sTxn);
|
||||
// VFALCO This is making a needless copy
|
||||
auto const vl = sit.getVL();
|
||||
SerialIter tSit (make_Slice(vl));
|
||||
return std::make_shared<STTx> (tSit);
|
||||
}
|
||||
|
||||
@@ -450,7 +451,7 @@ STTx::pointer Ledger::getSMTransaction (
|
||||
std::shared_ptr<SHAMapItem> const& item, SHAMapTreeNode::TNType type,
|
||||
TransactionMetaSet::pointer& txMeta) const
|
||||
{
|
||||
SerialIter sit (item->peekSerializer ());
|
||||
SerialIter sit (item->slice());
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
@@ -459,8 +460,9 @@ STTx::pointer Ledger::getSMTransaction (
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
Serializer sTxn (sit.getVL ());
|
||||
SerialIter tSit (sTxn);
|
||||
// VFALCO This is making a needless copy
|
||||
auto const vl = sit.getVL();
|
||||
SerialIter tSit (make_Slice(vl));
|
||||
|
||||
txMeta = std::make_shared<TransactionMetaSet> (
|
||||
item->getTag (), mLedgerSeq, sit.getVL ());
|
||||
@@ -496,7 +498,7 @@ bool Ledger::getTransaction (
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
// in tree with metadata
|
||||
SerialIter it (item->peekSerializer ());
|
||||
SerialIter it (item->slice());
|
||||
txn = getApp().getMasterTransaction ().fetch (txID, false);
|
||||
|
||||
if (!txn)
|
||||
@@ -529,7 +531,7 @@ bool Ledger::getTransactionMeta (
|
||||
if (type != SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
return false;
|
||||
|
||||
SerialIter it (item->peekSerializer ());
|
||||
SerialIter it (item->slice());
|
||||
it.getVL (); // skip transaction
|
||||
meta = std::make_shared<TransactionMetaSet> (txID, mLedgerSeq, it.getVL ());
|
||||
|
||||
@@ -547,7 +549,7 @@ bool Ledger::getMetaHex (uint256 const& transID, std::string& hex) const
|
||||
if (type != SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
return false;
|
||||
|
||||
SerialIter it (item->peekSerializer ());
|
||||
SerialIter it (item->slice());
|
||||
it.getVL (); // skip transaction
|
||||
hex = strHex (it.getVL ());
|
||||
return true;
|
||||
@@ -1041,7 +1043,7 @@ LedgerStateParms Ledger::writeBack (LedgerStateParms parms, SLE::ref entry)
|
||||
}
|
||||
|
||||
auto item = std::make_shared<SHAMapItem> (entry->getIndex ());
|
||||
entry->add (item->peekSerializer ());
|
||||
entry->add (item->peekSerializer());
|
||||
|
||||
if (create)
|
||||
{
|
||||
@@ -1211,7 +1213,7 @@ bool Ledger::visitAccountItems (
|
||||
static void visitHelper (
|
||||
std::function<void (SLE::ref)>& function, std::shared_ptr<SHAMapItem> const& item)
|
||||
{
|
||||
function (std::make_shared<SLE> (item->peekSerializer (), item->getTag ()));
|
||||
function (std::make_shared<SLE> (item->peekSerializer(), item->getTag ()));
|
||||
}
|
||||
|
||||
void Ledger::visitStateItems (std::function<void (SLE::ref)> function) const
|
||||
|
||||
Reference in New Issue
Block a user