diff options
author | Determinant <[email protected]> | 2018-09-10 16:06:27 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-09-10 16:06:27 -0400 |
commit | 6261c95184b86c43755071b351e6928f89e2343c (patch) | |
tree | 7a33a5d8ad3b252f629d52c5183eab90efb3438a /include/hotstuff/entity.h | |
parent | 05f2c56b909a2cd05a200ad663001696e4a23261 (diff) |
finish simple multithreaded verifier
Diffstat (limited to 'include/hotstuff/entity.h')
-rw-r--r-- | include/hotstuff/entity.h | 20 |
1 files changed, 15 insertions, 5 deletions
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; } |