Ledger query infrastructure. (#275)

* Added json ledger query param parser.

* Added initial query response creation.

* Updated client lib.

* Implemented get ledger by seq no.

* Added ledger query execution wrappers.

* Included log record info.

* Fixed empty output hash issue.

* Added bson support.

* Added db file existance check.

* Added requesy/reply tracking for queries in client lib.

* Improved multi connection usage in client lib.

* Added genesis ledger query support.

* Updated naming convention of query result fields.

* Comments.

* Used sqlite bind() for query param.

* Used binary hashes in ledger sqlite db.

* Missing const.
This commit is contained in:
Ravin Perera
2021-03-29 11:20:15 +05:30
committed by GitHub
parent 44fa3134ea
commit 948113398c
21 changed files with 829 additions and 188 deletions

View File

@@ -657,23 +657,20 @@ namespace consensus
}
}
if (!p.output_hash.empty())
if (ctx.stage < 3)
{
if (ctx.stage < 3)
// If the elected hash is our output hash, then place our output signature in the proposal.
// We only do this if we are at stage 1 or 2.
if (p.output_hash == ctx.user_outputs_hashtree.root_hash())
p.output_sig = ctx.user_outputs_our_sig;
}
else
{
// If this is the stage 3 proposal, collect the UNL output signatures matching the elected output hash.
for (const auto &[pubkey, cp] : ctx.candidate_proposals)
{
// If the elected hash is our output hash, then place our output signature in the proposal.
// We only do this if we are at stage 1 or 2.
if (p.output_hash == ctx.user_outputs_hashtree.root_hash())
p.output_sig = ctx.user_outputs_our_sig;
}
else
{
// If this is the stage 3 proposal, collect the UNL output signatures matching the elected output hash.
for (const auto &[pubkey, cp] : ctx.candidate_proposals)
{
if (cp.output_hash == p.output_hash)
ctx.user_outputs_unl_sig.emplace_back(cp.pubkey, cp.output_sig);
}
if (cp.output_hash == p.output_hash)
ctx.user_outputs_unl_sig.emplace_back(cp.pubkey, cp.output_sig);
}
}