diff options
author | Determinant <ted.sybil@gmail.com> | 2019-08-30 20:45:38 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2019-08-30 20:45:38 -0400 |
commit | 5ffbe0da60782ea2aa7f2fd872b8880333620133 (patch) | |
tree | 89c8b99426d5820ae07539578b3f97e3a6a051ca /src/entity.cpp | |
parent | 9b2128d042187b510b298cfbd724646b0300097e (diff) | |
parent | 870d09e53d93eee04e06fd225bfe4b124b7610aa (diff) |
Merge branch 'master' of github.com:hot-stuff/libhotstuff
Diffstat (limited to 'src/entity.cpp')
-rw-r--r-- | src/entity.cpp | 12 |
1 files changed, 12 insertions, 0 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); +} + } |