Add metadata JSON to set JSON.

Fix a bug where we try to access the existing node when we're creating a node.
Extra asserts to catch original node mishandlig.
This commit is contained in:
JoelKatz
2012-09-13 12:29:06 -07:00
parent aa35b33b19
commit 38dd9f3f88

View File

@@ -257,6 +257,8 @@ Json::Value LedgerEntrySet::getJson(int) const
}
ret["nodes" ] = nodes;
ret["metaData"] = mSet.getJson(0);
return ret;
}
@@ -358,7 +360,8 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
continue;
SLE::pointer origNode = mLedger->getSLE(it->first);
if (origNode->getType() == ltDIR_NODE) // No metadata for dir nodes
if (origNode && (origNode->getType() == ltDIR_NODE)) // No metadata for dir nodes
continue;
SLE::pointer curNode = it->second.mEntry;
@@ -366,6 +369,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
if (nType == TMNDeletedNode)
{
assert(origNode);
threadOwners(metaNode, origNode, mLedger, newMod);
if (origNode->getIFieldPresent(sfAmount))
@@ -398,7 +402,10 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
}
if (nType == TMNCreatedNode) // if created, thread to owner(s)
{
assert(!origNode);
threadOwners(metaNode, curNode, mLedger, newMod);
}
if ((nType == TMNCreatedNode) || (nType == TMNModifiedNode))
{
@@ -408,6 +415,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
if (nType == TMNModifiedNode)
{
assert(origNode);
if (origNode->getIFieldPresent(sfAmount))
{ // node has an amount, covers account root nodes and ripple nodes
STAmount amount = origNode->getIValueFieldAmount(sfAmount);