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

Fix the close time settings for ledger load #411

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/ripple/module/app/ledger/InboundLedger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,9 @@ Json::Value InboundLedger::getJson (int)
{
ret["have_state"] = mHaveState;
ret["have_transactions"] = mHaveTransactions;
if (!mHaveState)
ret["state_nodes"] = static_cast<Json::Value::UInt>
(mLedger->peekAccountStateMap()->size());
}

if (mAborted)
Expand Down
15 changes: 14 additions & 1 deletion src/ripple/module/app/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ bool ApplicationImp::loadOldLedger (

std::uint32_t seq = 1;
std::uint32_t closeTime = getApp().getOPs().getCloseTimeNC ();
std::uint32_t closeTimeResolution = 30;
bool closeTimeEstimated = false;
std::uint64_t totalCoins = 0;

if (ledger.get().isMember ("accountState"))
Expand All @@ -1195,6 +1197,16 @@ bool ApplicationImp::loadOldLedger (
{
closeTime = ledger.get()["close_time"].asUInt();
}
if (ledger.get().isMember ("close_time_resolution"))
{
closeTimeResolution =
ledger.get()["close_time_resolution"].asUInt();
}
if (ledger.get().isMember ("close_time_estimated"))
{
closeTimeEstimated =
ledger.get()["close_time_estimated"].asBool();
}
if (ledger.get().isMember ("total_coins"))
{
totalCoins =
Expand Down Expand Up @@ -1236,7 +1248,8 @@ bool ApplicationImp::loadOldLedger (
}
}

loadLedger->setAccepted();
loadLedger->setAccepted (closeTime,
closeTimeResolution, ! closeTimeEstimated);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/ripple/module/rpc/handlers/LedgerRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ Json::Value doLedgerRequest (RPC::Context& context)
{
// We don't have the ledger we need to figure out which ledger
// they want. Try to get it.
getApp().getInboundLedgers().findCreate (
refHash, refIndex, InboundLedger::fcGENERIC);
Json::Value jvResult = getApp().getInboundLedgers().findCreate (
refHash, refIndex, InboundLedger::fcGENERIC)->getJson (0);

Json::Value jvResult;
jvResult[jss::error] = "ledgerNotFound";
return jvResult;
}
Expand Down