From 2757995cb91dd02ebd6ede693cc6c02c4e359afe Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 7 Apr 2019 16:10:23 -0400 Subject: clean up consensus code --- include/hotstuff/liveness.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'include/hotstuff/liveness.h') diff --git a/include/hotstuff/liveness.h b/include/hotstuff/liveness.h index 903ac83..6d3c3cf 100644 --- a/include/hotstuff/liveness.h +++ b/include/hotstuff/liveness.h @@ -60,42 +60,42 @@ using pacemaker_bt = BoxObj; * direct parent, while including other tail blocks (up to parent_limit) as * uncles/aunts. */ class PMAllParents: public virtual PaceMaker { - block_t bqc_tail; + block_t hqc_tail; const int32_t parent_limit; /**< maximum number of parents */ - void reg_bqc_update() { - hsc->async_bqc_update().then([this](const block_t &bqc) { - const auto &pref = bqc->get_qc_ref(); + void reg_hqc_update() { + hsc->async_hqc_update().then([this](const block_t &hqc) { + const auto &pref = hqc; for (const auto &blk: hsc->get_tails()) { block_t b; for (b = blk; b->get_height() > pref->get_height(); b = b->get_parents()[0]); - if (b == pref && blk->get_height() > bqc_tail->get_height()) - bqc_tail = blk; + if (b == pref && blk->get_height() > hqc_tail->get_height()) + hqc_tail = blk; } - reg_bqc_update(); + reg_hqc_update(); }); } void reg_proposal() { hsc->async_wait_proposal().then([this](const Proposal &prop) { - bqc_tail = prop.blk; + hqc_tail = prop.blk; reg_proposal(); }); } void reg_receive_proposal() { hsc->async_wait_receive_proposal().then([this](const Proposal &prop) { - const auto &pref = hsc->get_bqc()->get_qc_ref(); + const auto &pref = hsc->get_hqc(); const auto &blk = prop.blk; block_t b; for (b = blk; b->get_height() > pref->get_height(); b = b->get_parents()[0]); - if (b == pref && blk->get_height() > bqc_tail->get_height()) - bqc_tail = blk; + if (b == pref && blk->get_height() > hqc_tail->get_height()) + hqc_tail = blk; reg_receive_proposal(); }); } @@ -103,15 +103,15 @@ class PMAllParents: public virtual PaceMaker { public: PMAllParents(int32_t parent_limit): parent_limit(parent_limit) {} void init() { - bqc_tail = hsc->get_genesis(); - reg_bqc_update(); + hqc_tail = hsc->get_genesis(); + reg_hqc_update(); reg_proposal(); reg_receive_proposal(); } std::vector get_parents() override { const auto &tails = hsc->get_tails(); - std::vector parents{bqc_tail}; + std::vector parents{hqc_tail}; auto nparents = tails.size(); if (parent_limit > 0) nparents = std::min(nparents, (size_t)parent_limit); @@ -119,7 +119,7 @@ class PMAllParents: public virtual PaceMaker { /* add the rest of tails as "uncles/aunts" */ for (const auto &blk: tails) { - if (blk != bqc_tail) + if (blk != hqc_tail) { parents.push_back(blk); if (!--nparents) break; @@ -386,7 +386,7 @@ class PMStickyProposer: virtual public PaceMaker { HOTSTUFF_LOG_PROTO("got block %s from %d", std::string(*prop.blk).c_str(), _proposer); p.reject(); (p = hsc->async_qc_finish(prop.blk)).then([this, blk=prop.blk, _proposer]() { - if (hsc->get_bqc()->get_qc_ref() == blk) + if (hsc->get_hqc() == blk) to_follower(_proposer); }); reg_cp_receive_proposal(); @@ -423,7 +423,7 @@ class PMStickyProposer: virtual public PaceMaker { to_candidate(); }); reg_cp_receive_proposal(); - proposer_propose(Proposal(-1, uint256_t(), hsc->get_genesis(), nullptr)); + proposer_propose(Proposal(-1, hsc->get_genesis(), nullptr)); } void to_candidate() { @@ -675,7 +675,7 @@ class PMRoundRobinProposer: virtual public PaceMaker { /* proposer unable to get a QC in time */ to_candidate(); }); - proposer_propose(Proposal(-1, uint256_t(), hsc->get_genesis(), nullptr)); + proposer_propose(Proposal(-1, hsc->get_genesis(), nullptr)); } void to_candidate() { -- cgit v1.2.3