aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-08-23 13:46:13 -0400
committerDeterminant <[email protected]>2019-08-23 13:46:13 -0400
commit870d09e53d93eee04e06fd225bfe4b124b7610aa (patch)
treeaa1a36aa8634f718db990507428e14de21b84580 /src
parent1e2bceedc30e41964345acc8f0bdd734e766e1f6 (diff)
fix bugs
Diffstat (limited to 'src')
-rw-r--r--src/entity.cpp12
-rw-r--r--src/hotstuff.cpp2
2 files changed, 13 insertions, 1 deletions
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);
+}
+
}
diff --git a/src/hotstuff.cpp b/src/hotstuff.cpp
index 5ae0fe6..b584af0 100644
--- a/src/hotstuff.cpp
+++ b/src/hotstuff.cpp
@@ -184,7 +184,7 @@ promise_t HotStuffBase::async_deliver_blk(const uint256_t &blk_hash,
for (const auto &phash: blk->get_parent_hashes())
pms.push_back(async_deliver_blk(phash, replica_id));
if (blk != get_genesis())
- pms.push_back(blk->verify(get_config(), vpool));
+ pms.push_back(blk->verify(this, vpool));
promise::all(pms).then([this, blk]() {
on_deliver_blk(blk);
});