Skip to content

Commit

Permalink
Revert "fix: Update Handler::Condition enum values #3417 (#4239)"
Browse files Browse the repository at this point in the history
This reverts commit 1c2ae10.
  • Loading branch information
intelliot authored Jun 29, 2023
1 parent 1c2ae10 commit de85454
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/ripple/rpc/impl/Handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ namespace RPC {
enum Condition {
NO_CONDITION = 0,
NEEDS_NETWORK_CONNECTION = 1,
NEEDS_CURRENT_LEDGER = 1 << 1,
NEEDS_CLOSED_LEDGER = 1 << 2,
NEEDS_CURRENT_LEDGER = 2 + NEEDS_NETWORK_CONNECTION,
NEEDS_CLOSED_LEDGER = 4 + NEEDS_NETWORK_CONNECTION,
};

struct Handler
Expand Down Expand Up @@ -94,18 +94,20 @@ conditionMet(Condition condition_required, T& context)
}

if (context.app.getOPs().isAmendmentBlocked() &&
(condition_required != NO_CONDITION))
(condition_required & NEEDS_CURRENT_LEDGER ||
condition_required & NEEDS_CLOSED_LEDGER))
{
return rpcAMENDMENT_BLOCKED;
}

if (context.app.getOPs().isUNLBlocked() &&
(condition_required != NO_CONDITION))
(condition_required & NEEDS_CURRENT_LEDGER ||
condition_required & NEEDS_CLOSED_LEDGER))
{
return rpcEXPIRED_VALIDATOR_LIST;
}

if ((condition_required != NO_CONDITION) &&
if ((condition_required & NEEDS_NETWORK_CONNECTION) &&
(context.netOps.getOperatingMode() < OperatingMode::SYNCING))
{
JLOG(context.j.info()) << "Insufficient network mode for RPC: "
Expand All @@ -117,7 +119,7 @@ conditionMet(Condition condition_required, T& context)
}

if (!context.app.config().standalone() &&
condition_required != NO_CONDITION)
condition_required & NEEDS_CURRENT_LEDGER)
{
if (context.ledgerMaster.getValidatedLedgerAge() >
Tuning::maxValidatedLedgerAge)
Expand All @@ -141,7 +143,7 @@ conditionMet(Condition condition_required, T& context)
}
}

if ((condition_required != NO_CONDITION) &&
if ((condition_required & NEEDS_CLOSED_LEDGER) &&
!context.ledgerMaster.getClosedLedger())
{
if (context.apiVersion == 1)
Expand Down

0 comments on commit de85454

Please sign in to comment.