Fix shadowing

This commit is contained in:
Nik Bougalis
2015-06-25 14:45:32 -07:00
committed by Vinnie Falco
parent 91b3227a0f
commit ccd6b46995

View File

@@ -47,7 +47,9 @@ Json::Value doLedgerRequest (RPC::Context& context)
auto const& jsonHash = context.params[jss::ledger_hash]; auto const& jsonHash = context.params[jss::ledger_hash];
if (!jsonHash.isString() || !ledgerHash.SetHex (jsonHash.asString ())) if (!jsonHash.isString() || !ledgerHash.SetHex (jsonHash.asString ()))
return RPC::invalid_field_message (jss::ledger_hash); return RPC::invalid_field_message (jss::ledger_hash);
} else { }
else
{
auto const& jsonIndex = context.params[jss::ledger_index]; auto const& jsonIndex = context.params[jss::ledger_index];
if (!jsonIndex.isNumeric ()) if (!jsonIndex.isNumeric ())
return RPC::invalid_field_message (jss::ledger_index); return RPC::invalid_field_message (jss::ledger_index);
@@ -63,12 +65,11 @@ Json::Value doLedgerRequest (RPC::Context& context)
if (ledgerIndex >= ledger->getLedgerSeq()) if (ledgerIndex >= ledger->getLedgerSeq())
return RPC::make_param_error("Ledger index too large"); return RPC::make_param_error("Ledger index too large");
auto const j = auto const j = deprecatedLogs().journal("RPCHandler");
deprecatedLogs().journal("RPCHandler");
// Try to get the hash of the desired ledger from the validated ledger // Try to get the hash of the desired ledger from the validated ledger
auto ledgerHash = hashOfSeq(*ledger, ledgerIndex, auto neededHash = hashOfSeq(*ledger, ledgerIndex,
getApp().getSLECache(), j); getApp().getSLECache(), j);
if (! ledgerHash) if (! neededHash)
{ {
// Find a ledger more likely to have the hash of the desired ledger // Find a ledger more likely to have the hash of the desired ledger
auto const refIndex = getCandidateLedger(ledgerIndex); auto const refIndex = getCandidateLedger(ledgerIndex);
@@ -98,12 +99,11 @@ Json::Value doLedgerRequest (RPC::Context& context)
return Json::Value(); return Json::Value();
} }
ledgerHash = hashOfSeq(*ledger, ledgerIndex, neededHash = hashOfSeq(*ledger, ledgerIndex,
getApp().getSLECache(), j); getApp().getSLECache(), j);
assert (ledgerHash);
if (! ledgerHash)
ledgerHash = zero; // kludge
} }
assert (neededHash);
ledgerHash = neededHash ? *neededHash : zero; // kludge
} }
auto ledger = ledgerMaster.getLedgerByHash (ledgerHash); auto ledger = ledgerMaster.getLedgerByHash (ledgerHash);