Simplify SHAMapTreeNode APIs:

- Provide separate functions for serializing depending on whether
  one wants a "wire" version of a node, or one suitable for hashing.
- Remove unused functions
This commit is contained in:
Nik Bougalis
2020-10-15 00:46:59 -07:00
parent ab77444fa3
commit 4a444f7d60
8 changed files with 125 additions and 151 deletions

View File

@@ -2734,24 +2734,21 @@ PeerImp::getLedger(std::shared_ptr<protocol::TMGetLedger> const& m)
{
// return account state root node if possible
Serializer rootNode(768);
if (stateMap.getRootNode(rootNode, snfWIRE))
stateMap.serializeRoot(rootNode);
reply.add_nodes()->set_nodedata(
rootNode.getDataPtr(), rootNode.getLength());
if (ledger->info().txHash != beast::zero)
{
reply.add_nodes()->set_nodedata(
rootNode.getDataPtr(), rootNode.getLength());
if (ledger->info().txHash != beast::zero)
auto const& txMap = ledger->txMap();
if (txMap.getHash() != beast::zero)
{
auto const& txMap = ledger->txMap();
rootNode.erase();
if (txMap.getHash() != beast::zero)
{
rootNode.erase();
if (txMap.getRootNode(rootNode, snfWIRE))
reply.add_nodes()->set_nodedata(
rootNode.getDataPtr(),
rootNode.getLength());
}
txMap.serializeRoot(rootNode);
reply.add_nodes()->set_nodedata(
rootNode.getDataPtr(), rootNode.getLength());
}
}
}