mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-04 02:38:02 +00:00
Check if amendment is enabled
This commit is contained in:
@@ -833,7 +833,7 @@ InboundLedger::receiveNode(protocol::TMLedgerData& packet, SHAMapAddNode& san)
|
||||
auto const nodeKey = static_cast<SHAMapLeafNode const*>(treeNode.get())->peekItem()->key();
|
||||
|
||||
SHAMapNodeID nodeID;
|
||||
if (app_.getAmendmentTable().isSupported(fixLedgerNodeDepth))
|
||||
if (app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth))
|
||||
{
|
||||
nodeID = SHAMapNodeID::createID(ledgerNode.nodedepth(), nodeKey);
|
||||
}
|
||||
@@ -1081,8 +1081,8 @@ InboundLedger::processData(std::shared_ptr<Peer> peer, protocol::TMLedgerData& p
|
||||
for (auto const& ledgerNode : packet.nodes())
|
||||
{
|
||||
if (!ledgerNode.has_nodedata() ||
|
||||
(app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodedepth()) ||
|
||||
(!app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodeid()))
|
||||
(app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth) && !ledgerNode.has_nodedepth()) ||
|
||||
(!app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth) && !ledgerNode.has_nodeid()))
|
||||
{
|
||||
JLOG(journal_.warn()) << "Got malformed ledger node";
|
||||
peer->charge(Resource::feeMalformedRequest, "ledger_node");
|
||||
|
||||
@@ -219,10 +219,7 @@ public:
|
||||
for (int i = 0; i < packet_ptr->nodes().size(); ++i)
|
||||
{
|
||||
auto const& ledgerNode = packet_ptr->nodes(i);
|
||||
|
||||
if (!ledgerNode.has_nodedata() ||
|
||||
(app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodedepth()) ||
|
||||
(!app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodeid()))
|
||||
if (!ledgerNode.has_nodedata())
|
||||
return;
|
||||
|
||||
auto treeNode = SHAMapTreeNode::makeFromWire(makeSlice(ledgerNode.nodedata()));
|
||||
|
||||
@@ -134,8 +134,8 @@ public:
|
||||
for (auto const& ledgerNode : packet.nodes())
|
||||
{
|
||||
if (!ledgerNode.has_nodedata() ||
|
||||
(app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodedepth()) ||
|
||||
(!app_.getAmendmentTable().isSupported(fixLedgerNodeDepth) && !ledgerNode.has_nodeid()))
|
||||
(app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth) && !ledgerNode.has_nodedepth()) ||
|
||||
(!app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth) && !ledgerNode.has_nodeid()))
|
||||
{
|
||||
JLOG(j_.warn()) << "Got malformed ledger node";
|
||||
peer->charge(Resource::feeMalformedRequest, "ledger_node");
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
auto const nodeKey = static_cast<SHAMapLeafNode const*>(treeNode.get())->peekItem()->key();
|
||||
|
||||
SHAMapNodeID nodeID;
|
||||
if (app_.getAmendmentTable().isSupported(fixLedgerNodeDepth))
|
||||
if (app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth))
|
||||
{
|
||||
nodeID = SHAMapNodeID::createID(ledgerNode.nodedepth(), nodeKey);
|
||||
}
|
||||
|
||||
@@ -3154,7 +3154,7 @@ PeerImp::processLedgerRequest(std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
break;
|
||||
protocol::TMLedgerNode* node{ledgerData.add_nodes()};
|
||||
node->set_nodedata(d.second.data(), d.second.size());
|
||||
if (app_.getAmendmentTable().isSupported(fixLedgerNodeDepth))
|
||||
if (app_.getAmendmentTable().isEnabled(fixLedgerNodeDepth))
|
||||
node->set_nodedepth(d.first.getDepth());
|
||||
else
|
||||
node->set_nodeid(d.first.getRawString());
|
||||
|
||||
Reference in New Issue
Block a user