From 6261c95184b86c43755071b351e6928f89e2343c Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 10 Sep 2018 16:06:27 -0400 Subject: finish simple multithreaded verifier --- include/hotstuff/entity.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include/hotstuff/entity.h') diff --git a/include/hotstuff/entity.h b/include/hotstuff/entity.h index 6f73db8..6327dfe 100644 --- a/include/hotstuff/entity.h +++ b/include/hotstuff/entity.h @@ -179,6 +179,16 @@ class Block { return true; } + promise_t verify(const ReplicaConfig &config, VeriPool &vpool) const { + return (qc ? qc->verify(config, vpool) : + promise_t([](promise_t &pm) { pm.resolve(true); })).then([this](bool result) { + if (!result) return false; + for (auto cmd: cmds) + if (!cmd->verify()) return false; + return true; + }); + } + int8_t get_decision() const { return decision; } bool is_delivered() const { return delivered; } @@ -223,11 +233,11 @@ class EntityStorage { } block_t add_blk(Block &&_blk, const ReplicaConfig &config) { - if (!_blk.verify(config)) - { - HOTSTUFF_LOG_WARN("invalid %s", std::string(_blk).c_str()); - return nullptr; - } + //if (!_blk.verify(config)) + //{ + // HOTSTUFF_LOG_WARN("invalid %s", std::string(_blk).c_str()); + // return nullptr; + //} block_t blk = new Block(std::move(_blk)); return blk_cache.insert(std::make_pair(blk->get_hash(), blk)).first->second; } -- cgit v1.2.3-70-g09d2