Skip to content

Commit

Permalink
Merge pull request #2271 from sisuresh/issue-2187-fixInfoEndpointBug
Browse files Browse the repository at this point in the history
changed info endpoint to get quorum set of ledger last closed by the network if available

Reviewed-by: MonsieurNicolas
  • Loading branch information
latobarita committed Sep 12, 2019
2 parents 07b049e + bfa0422 commit 14a0f41
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/main/ApplicationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,27 @@ ApplicationImpl::getJsonInfo()
}

auto& herder = getHerder();
info["quorum"] =
herder.getJsonQuorumInfo(getConfig().NODE_SEED.getPublicKey(), true,
false, herder.getCurrentLedgerSeq());

auto& quorumInfo = info["quorum"];

// Try to get quorum set info for the previous ledger closed by the
// network.
if (herder.getCurrentLedgerSeq() > 1)
{
quorumInfo =
herder.getJsonQuorumInfo(getConfig().NODE_SEED.getPublicKey(), true,
false, herder.getCurrentLedgerSeq() - 1);
}

// If the quorum set info for the previous ledger is missing, use the
// current ledger
auto qset = quorumInfo.get("qset", "");
if (quorumInfo.empty() || qset.empty())
{
quorumInfo =
herder.getJsonQuorumInfo(getConfig().NODE_SEED.getPublicKey(), true,
false, herder.getCurrentLedgerSeq());
}

auto invariantFailures = getInvariantManager().getJsonInfo();
if (!invariantFailures.empty())
Expand Down

0 comments on commit 14a0f41

Please sign in to comment.