aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-07-05 18:25:43 -0400
committerDeterminant <[email protected]>2019-07-05 18:25:43 -0400
commit346f688916d87ff856a81e9cf3f3e69245101475 (patch)
treee0a0ae7651ee42b487583bb33141863372bacb04 /src
parent200cbbeb4471443ddf964bfd0a37849ece0efdc4 (diff)
WIP: pacemaker clean up
Diffstat (limited to 'src')
-rw-r--r--src/consensus.cpp6
-rw-r--r--src/hotstuff.cpp4
-rw-r--r--src/hotstuff_app.cpp2
3 files changed, 9 insertions, 3 deletions
diff --git a/src/consensus.cpp b/src/consensus.cpp
index 5dadbe0..70c1876 100644
--- a/src/consensus.cpp
+++ b/src/consensus.cpp
@@ -142,6 +142,7 @@ void HotStuffCore::update(const block_t &nblk) {
{
const block_t &blk = *it;
blk->decision = 1;
+ do_consensus(blk);
LOG_PROTO("commit %s", std::string(*blk).c_str());
for (size_t i = 0; i < blk->cmds.size(); i++)
do_decide(Finality(id, 1, i, blk->height,
@@ -150,7 +151,7 @@ void HotStuffCore::update(const block_t &nblk) {
b_exec = blk;
}
-void HotStuffCore::on_propose(const std::vector<uint256_t> &cmds,
+block_t HotStuffCore::on_propose(const std::vector<uint256_t> &cmds,
const std::vector<block_t> &parents,
bytearray_t &&extra) {
if (parents.empty())
@@ -189,6 +190,7 @@ void HotStuffCore::on_propose(const std::vector<uint256_t> &cmds,
on_propose_(prop);
/* boradcast to other replicas */
do_broadcast_proposal(prop);
+ return bnew;
}
void HotStuffCore::on_receive_proposal(const Proposal &prop) {
@@ -249,8 +251,8 @@ void HotStuffCore::on_receive_vote(const Vote &vote) {
if (qsize + 1 == config.nmajority)
{
qc->compute();
- on_qc_finish(blk);
update_hqc(blk, qc);
+ on_qc_finish(blk);
}
}
/*** end HotStuff protocol logic ***/
diff --git a/src/hotstuff.cpp b/src/hotstuff.cpp
index 12a44dc..22f0d82 100644
--- a/src/hotstuff.cpp
+++ b/src/hotstuff.cpp
@@ -374,6 +374,10 @@ void HotStuffBase::do_vote(ReplicaID last_proposer, const Vote &vote) {
});
}
+void HotStuffBase::do_consensus(const block_t &blk) {
+ pmaker->on_consensus(blk);
+}
+
void HotStuffBase::do_decide(Finality &&fin) {
part_decided++;
state_machine_execute(fin);
diff --git a/src/hotstuff_app.cpp b/src/hotstuff_app.cpp
index 7aa9e1d..778c195 100644
--- a/src/hotstuff_app.cpp
+++ b/src/hotstuff_app.cpp
@@ -377,7 +377,7 @@ void HotStuffApp::start(const std::vector<std::tuple<NetAddr, bytearray_t, bytea
get_pace_maker().impeach();
reset_imp_timer();
});
- impeach_timer.add(impeach_timeout);
+ //impeach_timer.add(impeach_timeout);
HOTSTUFF_LOG_INFO("** starting the system with parameters **");
HOTSTUFF_LOG_INFO("blk_size = %lu", blk_size);
HOTSTUFF_LOG_INFO("conns = %lu", HotStuff::size());