mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Refactor and improve the SHAMap code:
This commit combines a number of cleanups, targeting both the code structure and the code logic. Large changes include: - Using more strongly-typed classes for SHAMap nodes, instead of relying on runtime-time detection of class types. This change saves 16 bytes of memory per node. - Improving the interface of SHAMap::addGiveItem and SHAMap::addItem to avoid the need for passing two bool arguments. - Documenting the "copy-on-write" semantics that SHAMap uses to efficiently track changes in individual nodes. - Removing unused code and simplifying several APIs. - Improving function naming.
This commit is contained in:
@@ -49,24 +49,6 @@ isValidated(LedgerMaster& ledgerMaster, std::uint32_t seq, uint256 const& hash)
|
||||
return ledgerMaster.getHashBySeq(seq) == hash;
|
||||
}
|
||||
|
||||
bool
|
||||
getMetaHex(Ledger const& ledger, uint256 const& transID, std::string& hex)
|
||||
{
|
||||
SHAMapTreeNode::TNType type;
|
||||
auto const item = ledger.txMap().peekItem(transID, type);
|
||||
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
if (type != SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
return false;
|
||||
|
||||
SerialIter it(item->slice());
|
||||
it.getVL(); // skip transaction
|
||||
hex = strHex(makeSlice(it.getVL()));
|
||||
return true;
|
||||
}
|
||||
|
||||
struct TxResult
|
||||
{
|
||||
Transaction::pointer txn;
|
||||
|
||||
Reference in New Issue
Block a user