From b5d5e8375373eaed6a5544860336a74bbd96446d Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 6 Jul 2019 22:36:51 -0400 Subject: improve RR Pacemaker --- src/consensus.cpp | 15 +++------------ src/hotstuff_client.cpp | 12 ------------ 2 files changed, 3 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/consensus.cpp b/src/consensus.cpp index 70c1876..d9c1f64 100644 --- a/src/consensus.cpp +++ b/src/consensus.cpp @@ -157,21 +157,12 @@ block_t HotStuffCore::on_propose(const std::vector &cmds, if (parents.empty()) throw std::runtime_error("empty parents"); for (const auto &_: parents) tails.erase(_); - block_t p = parents[0]; - quorum_cert_bt qc = nullptr; - block_t qc_ref = nullptr; - /* a block can optionally carray a QC */ - if (p->voted.size() >= config.nmajority) - { - qc = p->self_qc->clone(); - qc_ref = p; - } /* create the new block */ block_t bnew = storage->add_blk( new Block(parents, cmds, - std::move(qc), std::move(extra), - p->height + 1, - qc_ref, + hqc.second->clone(), std::move(extra), + parents[0]->height + 1, + hqc.first, nullptr )); const uint256_t bnew_hash = bnew->get_hash(); diff --git a/src/hotstuff_client.cpp b/src/hotstuff_client.cpp index 7914125..831b7ff 100644 --- a/src/hotstuff_client.cpp +++ b/src/hotstuff_client.cpp @@ -108,18 +108,9 @@ void client_resp_cmd_handler(MsgRespCmd &&msg, const Net::conn_t &) { elapsed.push_back(std::make_pair(tv, et.elapsed_sec)); #endif waiting.erase(it); -#ifndef HOTSTUFF_AUTOCLI while (try_send()); -#endif } -//#ifdef HOTSTUFF_AUTOCLI -//void client_demand_cmd_handler(hotstuff::MsgDemandCmd &&msg, const Net::conn_t &) { -// for (size_t i = 0; i < msg.ncmd; i++) -// try_send(false); -//} -//#endif - std::pair split_ip_port_cport(const std::string &s) { auto ret = salticidae::trim_all(salticidae::split(s, ";")); return std::make_pair(ret[0], ret[1]); @@ -141,9 +132,6 @@ int main(int argc, char **argv) { ev_sigterm.add(SIGTERM); mn.reg_handler(client_resp_cmd_handler); -//#ifdef HOTSTUFF_AUTOCLI -// mn.reg_handler(client_demand_cmd_handler); -//#endif mn.start(); config.add_opt("idx", opt_idx, Config::SET_VAL); -- cgit v1.2.3-70-g09d2