-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Change enum values to be powers of two (fix #3417) #4239
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,8 @@ namespace RPC { | |
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, | ||
}; | ||
|
||
struct Handler | ||
|
@@ -94,20 +94,18 @@ conditionMet(Condition condition_required, T& context) | |
} | ||
|
||
if (context.app.getOPs().isAmendmentBlocked() && | ||
(condition_required & NEEDS_CURRENT_LEDGER || | ||
condition_required & NEEDS_CLOSED_LEDGER)) | ||
(condition_required != NO_CONDITION)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not the same test as before. Is the change on purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I agree that the conditions have changed. I made this change approximately one year ago, so I am spacing out on the details. Let me think/check and get back to you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the old values, I think the conditions are equivalent. Between Now whether that was the intent is a different question. It turns out there are only two operations which have |
||
{ | ||
return rpcAMENDMENT_BLOCKED; | ||
} | ||
|
||
if (context.app.getOPs().isUNLBlocked() && | ||
(condition_required & NEEDS_CURRENT_LEDGER || | ||
condition_required & NEEDS_CLOSED_LEDGER)) | ||
(condition_required != NO_CONDITION)) | ||
{ | ||
return rpcEXPIRED_VALIDATOR_LIST; | ||
} | ||
|
||
if ((condition_required & NEEDS_NETWORK_CONNECTION) && | ||
if ((condition_required != NO_CONDITION) && | ||
(context.netOps.getOperatingMode() < OperatingMode::SYNCING)) | ||
{ | ||
JLOG(context.j.info()) << "Insufficient network mode for RPC: " | ||
|
@@ -119,7 +117,7 @@ conditionMet(Condition condition_required, T& context) | |
} | ||
|
||
if (!context.app.config().standalone() && | ||
condition_required & NEEDS_CURRENT_LEDGER) | ||
condition_required != NO_CONDITION) | ||
{ | ||
if (context.ledgerMaster.getValidatedLedgerAge() > | ||
Tuning::maxValidatedLedgerAge) | ||
|
@@ -143,7 +141,7 @@ conditionMet(Condition condition_required, T& context) | |
} | ||
} | ||
|
||
if ((condition_required & NEEDS_CLOSED_LEDGER) && | ||
if ((condition_required != NO_CONDITION) && | ||
!context.ledgerMaster.getClosedLedger()) | ||
{ | ||
if (context.apiVersion == 1) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
NEEDS_NETWORK_CONNECTION
not required anymore?