diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-03-29 15:18:33 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-29 15:18:33 +0800 |
commit | a69376bd9d144c462ae2b577c8147e96e4a60553 (patch) | |
tree | 68a3705241ec08a6465a2029b97efaee4dd7981d /core | |
parent | 92d1b675e7acff789a819426521efc99bdbd9aff (diff) | |
download | dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar.gz dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar.bz2 dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar.lz dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar.xz dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.tar.zst dexon-consensus-a69376bd9d144c462ae2b577c8147e96e4a60553.zip |
syncer: confirmed block without randomness (#532)
Diffstat (limited to 'core')
-rw-r--r-- | core/syncer/agreement.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/syncer/agreement.go b/core/syncer/agreement.go index a4a0f20..13da027 100644 --- a/core/syncer/agreement.go +++ b/core/syncer/agreement.go @@ -39,7 +39,7 @@ type agreement struct { outputChan chan<- *types.Block pullChan chan<- common.Hash blocks map[types.Position]map[common.Hash]*types.Block - agreementResults map[common.Hash]struct{} + agreementResults map[common.Hash][]byte latestCRSRound uint64 pendingAgrs map[uint64]map[common.Hash]*types.AgreementResult pendingBlocks map[uint64]map[common.Hash]*types.Block @@ -62,7 +62,7 @@ func newAgreement(chainTip uint64, outputChan: ch, pullChan: pullChan, blocks: make(map[types.Position]map[common.Hash]*types.Block), - agreementResults: make(map[common.Hash]struct{}), + agreementResults: make(map[common.Hash][]byte), logger: logger, pendingAgrs: make( map[uint64]map[common.Hash]*types.AgreementResult), @@ -105,7 +105,11 @@ func (a *agreement) processBlock(b *types.Block) { if _, exist := a.confirmedBlocks[b.Hash]; exist { return } - if _, exist := a.agreementResults[b.Hash]; exist { + if rand, exist := a.agreementResults[b.Hash]; exist { + if b.Position.Round >= core.DKGDelayRound && + len(b.Finalization.Randomness) == 0 { + b.Finalization.Randomness = rand + } a.confirm(b) } else { if _, exist := a.blocks[b.Position]; !exist { @@ -219,7 +223,7 @@ func (a *agreement) processAgreementResult(r *types.AgreementResult) { return } } - a.agreementResults[r.BlockHash] = struct{}{} + a.agreementResults[r.BlockHash] = r.Randomness loop: for { select { |