diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-25 10:14:42 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-27 15:25:10 +0800 |
commit | b8ced165b1fb03394f8758e08148b0e5d06aa07b (patch) | |
tree | fa327764a4cf564bb4aa39c1570ffd7f292c7ba1 /core/agreement.go | |
parent | 6efe199cb38eb4cb9a9a64d98ff5f8c4fb997da7 (diff) | |
download | dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.gz dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.tar.zst dexon-consensus-b8ced165b1fb03394f8758e08148b0e5d06aa07b.zip |
core: Remove agreement result (#514)
* core: remove agreement result for round with randomness
* remove agr test in syncer
* fixup
* remove randomness field from agreement result
* modify test
Diffstat (limited to 'core/agreement.go')
-rw-r--r-- | core/agreement.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/agreement.go b/core/agreement.go index 1ba9034..5e7b7de 100644 --- a/core/agreement.go +++ b/core/agreement.go @@ -42,6 +42,7 @@ var ( ErrNotInNotarySet = fmt.Errorf("not in notary set") ErrIncorrectVoteSignature = fmt.Errorf("incorrect vote signature") ErrIncorrectVotePartialSignature = fmt.Errorf("incorrect vote psig") + ErrMismatchBlockPosition = fmt.Errorf("mismatch block position") ) // ErrFork for fork error in agreement. @@ -513,6 +514,25 @@ func (a *agreement) processVote(vote *types.Vote) error { return nil } +func (a *agreement) processFinalizedBlock(block *types.Block) { + a.lock.Lock() + defer a.lock.Unlock() + if a.hasOutput { + return + } + aID := a.agreementID() + if aID.Older(block.Position) { + return + } + a.addCandidateBlockNoLock(block) + a.hasOutput = true + a.data.recv.ConfirmBlock(block.Hash, nil) + if a.doneChan != nil { + close(a.doneChan) + a.doneChan = nil + } +} + func (a *agreement) done() <-chan struct{} { a.lock.Lock() defer a.lock.Unlock() |