aboutsummaryrefslogtreecommitdiffstats
path: root/core/syncer
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2019-04-08 16:14:27 +0800
committerJimmy Hu <jimmy.hu@dexon.org>2019-04-08 16:14:27 +0800
commit26c83d1cd15ab9225cb13d7324ac721b00a3fcd1 (patch)
tree619536ead56abe2eacb4d165422ddddf6f7bbf23 /core/syncer
parent337b5729c1cea837ac5ee8e1646dca587f52ebbd (diff)
downloaddexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar.gz
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar.bz2
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar.lz
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar.xz
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.tar.zst
dexon-consensus-26c83d1cd15ab9225cb13d7324ac721b00a3fcd1.zip
core: refine VerifyAgreementResult (#553)
* Pass notary set directly to VerifyAgreementResult * Fix core.Consensus * Fix syncer
Diffstat (limited to 'core/syncer')
-rw-r--r--core/syncer/agreement.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/syncer/agreement.go b/core/syncer/agreement.go
index d39c246..b414e11 100644
--- a/core/syncer/agreement.go
+++ b/core/syncer/agreement.go
@@ -176,7 +176,12 @@ func (a *agreement) processAgreementResult(r *types.AgreementResult) {
a.logger.Trace("Agreement result cached", "result", r)
return
}
- if err := core.VerifyAgreementResult(r, a.cache); err != nil {
+ notarySet, err := a.cache.GetNotarySet(r.Position.Round)
+ if err != nil {
+ a.logger.Error("unable to get notary set", "result", r, "error", err)
+ return
+ }
+ if err := core.VerifyAgreementResult(r, notarySet); err != nil {
a.logger.Error("Agreement result verification failed",
"result", r,
"error", err)
@@ -252,13 +257,18 @@ func (a *agreement) processNewCRS(round uint64) {
a.latestCRSRound = round
// Verify all pending results.
for r := prevRound; r <= a.latestCRSRound; r++ {
+ notarySet, err := a.cache.GetNotarySet(r)
+ if err != nil {
+ a.logger.Error("Unable to get notary set", "round", r, "error", err)
+ continue
+ }
pendingsForRound := a.pendingAgrs[r]
if pendingsForRound == nil {
continue
}
delete(a.pendingAgrs, r)
for _, res := range pendingsForRound {
- if err := core.VerifyAgreementResult(res, a.cache); err != nil {
+ if err := core.VerifyAgreementResult(res, notarySet); err != nil {
a.logger.Error("Invalid agreement result",
"result", res,
"error", err)