Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Change enum values to be powers of two (fix #3417)" #4604

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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