From 870d09e53d93eee04e06fd225bfe4b124b7610aa Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 23 Aug 2019 13:46:13 -0400 Subject: fix bugs --- src/entity.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/entity.cpp') diff --git a/src/entity.cpp b/src/entity.cpp index e90e0f2..59febac 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -62,4 +62,16 @@ void Block::unserialize(DataStream &s, HotStuffCore *hsc) { this->hash = salticidae::get_hash(*this); } +bool Block::verify(const HotStuffCore *hsc) const { + return qc && qc->verify(hsc->get_config()); +} + +promise_t Block::verify(const HotStuffCore *hsc, VeriPool &vpool) const { + if (!qc) + return promise_t([](promise_t &pm) { pm.resolve(false); }); + if (qc->get_obj_hash() == hsc->get_genesis()->get_hash()) + return promise_t([](promise_t &pm) { pm.resolve(true); }); + return qc->verify(hsc->get_config(), vpool); +} + } -- cgit v1.2.3-70-g09d2