mirror of
https://github.com/Xahau/xahaud.git
synced 2026-04-29 15:37:46 +00:00
Clean up and modernize code:
This commit removes obsolete comments, dead or no longer useful code, and workarounds for several issues that were present in older compilers that we no longer support. Specifically: - It improves the transaction metadata handling class, simplifying its use and making it less error-prone. - It reduces the footprint of the Serializer class by consolidating code and leveraging templates. - It cleanups the ST* class hierarchy, removing dead code, improving and consolidating code to reduce complexity and code duplication. - It shores up the handling of currency codes and the conversation between 160-bit currency codes and their string representation. - It migrates beast::secure_erase to the ripple namespace and uses a call to OpenSSL_cleanse instead of the custom implementation.
This commit is contained in:
@@ -123,9 +123,7 @@ ApplyStateTable::apply(
|
||||
std::shared_ptr<Serializer> sMeta;
|
||||
if (!to.open())
|
||||
{
|
||||
TxMeta meta;
|
||||
// VFALCO Shouldn't TxMeta ctor do this?
|
||||
meta.init(tx.getTransactionID(), to.seq());
|
||||
TxMeta meta(tx.getTransactionID(), to.seq());
|
||||
if (deliver)
|
||||
meta.setDeliveredAmount(*deliver);
|
||||
Mods newMod;
|
||||
@@ -526,12 +524,24 @@ ApplyStateTable::threadItem(TxMeta& meta, std::shared_ptr<SLE> const& sle)
|
||||
{
|
||||
key_type prevTxID;
|
||||
LedgerIndex prevLgrID;
|
||||
|
||||
if (!sle->thread(meta.getTxID(), meta.getLgrSeq(), prevTxID, prevLgrID))
|
||||
return;
|
||||
if (prevTxID.isZero())
|
||||
return;
|
||||
TxMeta::thread(
|
||||
meta.getAffectedNode(sle, sfModifiedNode), prevTxID, prevLgrID);
|
||||
|
||||
if (!prevTxID.isZero())
|
||||
{
|
||||
auto& node = meta.getAffectedNode(sle, sfModifiedNode);
|
||||
|
||||
if (node.getFieldIndex(sfPreviousTxnID) == -1)
|
||||
{
|
||||
assert(node.getFieldIndex(sfPreviousTxnLgrSeq) == -1);
|
||||
node.setFieldH256(sfPreviousTxnID, prevTxID);
|
||||
node.setFieldU32(sfPreviousTxnLgrSeq, prevLgrID);
|
||||
}
|
||||
|
||||
assert(node.getFieldH256(sfPreviousTxnID) == prevTxID);
|
||||
assert(node.getFieldU32(sfPreviousTxnLgrSeq) == prevLgrID);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
|
||||
Reference in New Issue
Block a user