diff options
author | Determinant <[email protected]> | 2018-08-16 15:57:06 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-08-16 15:57:06 -0400 |
commit | a5f0a7198334caf95bff0bf1c6c5a2c30eb32795 (patch) | |
tree | b3d7ce958ddec7fc05fcf0f703eadd5dea40d719 /include/hotstuff/consensus.h | |
parent | a95e4362fa197b44138616c8e1c8a05d192b0a82 (diff) |
fix bugs in PaceMaker
Diffstat (limited to 'include/hotstuff/consensus.h')
-rw-r--r-- | include/hotstuff/consensus.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/hotstuff/consensus.h b/include/hotstuff/consensus.h index a99e6af..d27f8c5 100644 --- a/include/hotstuff/consensus.h +++ b/include/hotstuff/consensus.h @@ -32,13 +32,18 @@ class HotStuffCore { std::unordered_map<block_t, promise_t> qc_waiting; promise_t propose_waiting; promise_t receive_proposal_waiting; + promise_t bqc_update_waiting; + /* == feature switches == */ + /** always vote negatively, useful for some PaceMakers */ + bool neg_vote; block_t get_delivered_blk(const uint256_t &blk_hash); void sanity_check_delivered(const block_t &blk); void check_commit(const block_t &_bqc); bool update(const uint256_t &bqc_hash); + void on_bqc_update(); void on_qc_finish(const block_t &blk); - void on_propose_(const block_t &blk); + void on_propose_(const Proposal &prop); void on_receive_proposal_(const Proposal &prop); protected: @@ -127,9 +132,11 @@ class HotStuffCore { /** Get a promise resolved when the block gets a QC. */ promise_t async_qc_finish(const block_t &blk); /** Get a promise resolved when a new block is proposed. */ - promise_t async_wait_propose(); + promise_t async_wait_proposal(); /** Get a promise resolved when a new proposal is received. */ promise_t async_wait_receive_proposal(); + /** Get a promise resolved when bqc is updated. */ + promise_t async_bqc_update(); /* Other useful functions */ block_t get_genesis() { return b0; } @@ -137,6 +144,7 @@ class HotStuffCore { ReplicaID get_id() const { return id; } const std::set<block_t, BlockHeightCmp> get_tails() const { return tails; } operator std::string () const; + void set_neg_vote(bool _neg_vote) { neg_vote = _neg_vote; } }; /** Abstraction for proposal messages. */ @@ -154,7 +162,7 @@ struct Proposal: public Serializable { Proposal(): blk(nullptr), hsc(nullptr) {} Proposal(ReplicaID proposer, const uint256_t &bqc_hash, - block_t &blk, + const block_t &blk, HotStuffCore *hsc): proposer(proposer), bqc_hash(bqc_hash), |