aboutsummaryrefslogtreecommitdiff
path: root/src/consensus.cpp
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-08-02 20:26:21 -0400
committerDeterminant <[email protected]>2018-08-02 20:26:21 -0400
commit4c42ac64c2ff821306609898a58126f2da32c7d4 (patch)
treebe01d2f18b09fc056fa520b9ea548f1742a9781c /src/consensus.cpp
parent13c4335dc46fc1a4d6757279898347d99483dbfe (diff)
WIP: sticky proposer pacemaker
Diffstat (limited to 'src/consensus.cpp')
-rw-r--r--src/consensus.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/consensus.cpp b/src/consensus.cpp
index cc1d572..40a5e44 100644
--- a/src/consensus.cpp
+++ b/src/consensus.cpp
@@ -64,6 +64,7 @@ bool HotStuffCore::on_deliver_blk(const block_t &blk) {
blk->delivered = true;
LOG_DEBUG("deliver %s", std::string(*blk).c_str());
+ on_deliver_blk_(blk);
return true;
}
@@ -173,6 +174,8 @@ void HotStuffCore::on_receive_proposal(const Proposal &prop) {
#ifdef HOTSTUFF_PROTO_LOG
LOG_INFO("now state: %s", std::string(*this).c_str());
#endif
+ if (bnew->qc_ref) on_qc_finish(bnew);
+ on_receive_proposal_(prop);
do_vote(prop.proposer,
Vote(id,
bqc->get_hash(),
@@ -272,12 +275,22 @@ promise_t HotStuffCore::async_wait_propose() {
return propose_waiting;
}
+promise_t HotStuffCore::async_wait_receive_proposal() {
+ return receive_proposal_waiting;
+}
+
void HotStuffCore::on_propose_(const block_t &blk) {
auto t = std::move(propose_waiting);
propose_waiting = promise_t();
t.resolve(blk);
}
+void HotStuffCore::on_receive_proposal_(const Proposal &prop) {
+ auto t = std::move(receive_proposal_waiting);
+ receive_proposal_waiting = promise_t();
+ t.resolve(prop);
+}
+
HotStuffCore::operator std::string () const {
DataStream s;
s << "<hotstuff "