From c210864062b988a6fc8b0d7e2f879f15b9e41134 Mon Sep 17 00:00:00 2001 From: intelliot Date: Thu, 29 Jun 2023 16:15:57 +0000 Subject: [PATCH] deploy: 1c2ae10dc057d5c7c76d0df2c5a92fc753e4769a --- Handler_8h_source.html | 130 ++++++++++++++++++------------------ namespaceripple_1_1RPC.html | 4 +- 2 files changed, 66 insertions(+), 68 deletions(-) diff --git a/Handler_8h_source.html b/Handler_8h_source.html index 63a76a974a..e9bf17e232 100644 --- a/Handler_8h_source.html +++ b/Handler_8h_source.html @@ -110,8 +110,8 @@ $(function() {
39 enum Condition {
40  NO_CONDITION = 0,
41  NEEDS_NETWORK_CONNECTION = 1,
-
42  NEEDS_CURRENT_LEDGER = 2 + NEEDS_NETWORK_CONNECTION,
-
43  NEEDS_CLOSED_LEDGER = 4 + NEEDS_NETWORK_CONNECTION,
+
42  NEEDS_CURRENT_LEDGER = 1 << 1,
+
43  NEEDS_CLOSED_LEDGER = 1 << 2,
44 };
45 
46 struct Handler
@@ -163,70 +163,68 @@ $(function() {
94  }
95 
96  if (context.app.getOPs().isAmendmentBlocked() &&
-
97  (condition_required & NEEDS_CURRENT_LEDGER ||
-
98  condition_required & NEEDS_CLOSED_LEDGER))
-
99  {
-
100  return rpcAMENDMENT_BLOCKED;
-
101  }
-
102 
-
103  if (context.app.getOPs().isUNLBlocked() &&
-
104  (condition_required & NEEDS_CURRENT_LEDGER ||
-
105  condition_required & NEEDS_CLOSED_LEDGER))
-
106  {
-
107  return rpcEXPIRED_VALIDATOR_LIST;
-
108  }
-
109 
-
110  if ((condition_required & NEEDS_NETWORK_CONNECTION) &&
-
111  (context.netOps.getOperatingMode() < OperatingMode::SYNCING))
-
112  {
-
113  JLOG(context.j.info()) << "Insufficient network mode for RPC: "
-
114  << context.netOps.strOperatingMode();
-
115 
-
116  if (context.apiVersion == 1)
-
117  return rpcNO_NETWORK;
-
118  return rpcNOT_SYNCED;
-
119  }
-
120 
-
121  if (!context.app.config().standalone() &&
-
122  condition_required & NEEDS_CURRENT_LEDGER)
-
123  {
-
124  if (context.ledgerMaster.getValidatedLedgerAge() >
-
125  Tuning::maxValidatedLedgerAge)
-
126  {
-
127  if (context.apiVersion == 1)
-
128  return rpcNO_CURRENT;
-
129  return rpcNOT_SYNCED;
-
130  }
-
131 
-
132  auto const cID = context.ledgerMaster.getCurrentLedgerIndex();
-
133  auto const vID = context.ledgerMaster.getValidLedgerIndex();
-
134 
-
135  if (cID + 10 < vID)
-
136  {
-
137  JLOG(context.j.debug())
-
138  << "Current ledger ID(" << cID
-
139  << ") is less than validated ledger ID(" << vID << ")";
-
140  if (context.apiVersion == 1)
-
141  return rpcNO_CURRENT;
-
142  return rpcNOT_SYNCED;
-
143  }
-
144  }
-
145 
-
146  if ((condition_required & NEEDS_CLOSED_LEDGER) &&
-
147  !context.ledgerMaster.getClosedLedger())
-
148  {
-
149  if (context.apiVersion == 1)
-
150  return rpcNO_CLOSED;
-
151  return rpcNOT_SYNCED;
-
152  }
-
153 
-
154  return rpcSUCCESS;
-
155 }
-
156 
-
157 } // namespace RPC
-
158 } // namespace ripple
-
159 
-
160 #endif
+
97  (condition_required != NO_CONDITION))
+
98  {
+
99  return rpcAMENDMENT_BLOCKED;
+
100  }
+
101 
+
102  if (context.app.getOPs().isUNLBlocked() &&
+
103  (condition_required != NO_CONDITION))
+
104  {
+
105  return rpcEXPIRED_VALIDATOR_LIST;
+
106  }
+
107 
+
108  if ((condition_required != NO_CONDITION) &&
+
109  (context.netOps.getOperatingMode() < OperatingMode::SYNCING))
+
110  {
+
111  JLOG(context.j.info()) << "Insufficient network mode for RPC: "
+
112  << context.netOps.strOperatingMode();
+
113 
+
114  if (context.apiVersion == 1)
+
115  return rpcNO_NETWORK;
+
116  return rpcNOT_SYNCED;
+
117  }
+
118 
+
119  if (!context.app.config().standalone() &&
+
120  condition_required != NO_CONDITION)
+
121  {
+
122  if (context.ledgerMaster.getValidatedLedgerAge() >
+
123  Tuning::maxValidatedLedgerAge)
+
124  {
+
125  if (context.apiVersion == 1)
+
126  return rpcNO_CURRENT;
+
127  return rpcNOT_SYNCED;
+
128  }
+
129 
+
130  auto const cID = context.ledgerMaster.getCurrentLedgerIndex();
+
131  auto const vID = context.ledgerMaster.getValidLedgerIndex();
+
132 
+
133  if (cID + 10 < vID)
+
134  {
+
135  JLOG(context.j.debug())
+
136  << "Current ledger ID(" << cID
+
137  << ") is less than validated ledger ID(" << vID << ")";
+
138  if (context.apiVersion == 1)
+
139  return rpcNO_CURRENT;
+
140  return rpcNOT_SYNCED;
+
141  }
+
142  }
+
143 
+
144  if ((condition_required != NO_CONDITION) &&
+
145  !context.ledgerMaster.getClosedLedger())
+
146  {
+
147  if (context.apiVersion == 1)
+
148  return rpcNO_CLOSED;
+
149  return rpcNOT_SYNCED;
+
150  }
+
151 
+
152  return rpcSUCCESS;
+
153 }
+
154 
+
155 } // namespace RPC
+
156 } // namespace ripple
+
157 
+
158 #endif
@ rpcNO_NETWORK
Definition: ErrorCodes.h:66
Definition: Context.h:53
diff --git a/namespaceripple_1_1RPC.html b/namespaceripple_1_1RPC.html index fb807403d4..0f41cd06e8 100644 --- a/namespaceripple_1_1RPC.html +++ b/namespaceripple_1_1RPC.html @@ -147,8 +147,8 @@ Typedefs Enumerations enum  Condition { NO_CONDITION = 0, NEEDS_NETWORK_CONNECTION = 1, -NEEDS_CURRENT_LEDGER = 2 + NEEDS_NETWORK_CONNECTION, -NEEDS_CLOSED_LEDGER = 4 + NEEDS_NETWORK_CONNECTION +NEEDS_CURRENT_LEDGER = 1 << 1, +NEEDS_CLOSED_LEDGER = 1 << 2 }   enum  LedgerShortcut { CURRENT,