From 698a0373f7d72ce0ee0e557ed0352a8594a7a6b0 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 6 Apr 2019 18:14:42 -0400 Subject: ... --- include/hotstuff/hotstuff.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/hotstuff') diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h index f7acccc..10dcb84 100644 --- a/include/hotstuff/hotstuff.h +++ b/include/hotstuff/hotstuff.h @@ -140,7 +140,7 @@ class HotStuffBase: public HotStuffCore { /** libevent handle */ EventContext ec; VeriPool vpool; - std::unordered_set peers; + std::vector peers; private: /** whether libevent handle is owned by itself */ @@ -212,8 +212,7 @@ class HotStuffBase: public HotStuffCore { /* Submit the command to be decided. */ promise_t exec_command(uint256_t cmd); - void add_replica(ReplicaID idx, const NetAddr &addr, pubkey_bt &&pub_key); - void start(bool ec_loop = false); + void start(std::vector> &&replicas, bool ec_loop = false); size_t size() const { return peers.size(); } PaceMaker &get_pace_maker() { return *pmaker; } @@ -279,9 +278,11 @@ class HotStuff: public HotStuffBase { nworker, netconfig) {} - void add_replica(ReplicaID idx, const NetAddr &addr, const bytearray_t &pubkey_raw) { - DataStream s(pubkey_raw); - HotStuffBase::add_replica(idx, addr, new PubKeyType(pubkey_raw)); + void start(const std::vector> &replicas, bool ec_loop = false) { + std::vector> reps; + for (auto &r: replicas) + reps.push_back(std::make_pair(r.first, new PubKeyType(r.second))); + HotStuffBase::start(std::move(reps), ec_loop); } }; -- cgit v1.2.3-70-g09d2