diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-08-07 14:33:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 14:33:13 +0800 |
commit | 3a929b656b6bd5846849fd98dc29ff761db97ed3 (patch) | |
tree | 25438de64f434866293aa408915c735352949e6f /core | |
parent | 5a818558fc0e8f038ba92b5b6dfa3b55a04b9589 (diff) | |
download | dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar.gz dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar.bz2 dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar.lz dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar.xz dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.tar.zst dexon-consensus-3a929b656b6bd5846849fd98dc29ff761db97ed3.zip |
simulation: Show internal and external timestamp latency. (#30)
Diffstat (limited to 'core')
-rw-r--r-- | core/blocklattice.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/blocklattice.go b/core/blocklattice.go index 1f12474..f94cc9a 100644 --- a/core/blocklattice.go +++ b/core/blocklattice.go @@ -66,6 +66,9 @@ type BlockLattice struct { candidateSet map[common.Hash]*types.Block ABS map[common.Hash]map[types.ValidatorID]uint64 AHV map[common.Hash]map[types.ValidatorID]uint64 + + // Timestamp. + timestampEngine consensusTimestamp } // NewBlockLattice returns a new empty BlockLattice instance. @@ -86,6 +89,7 @@ func NewBlockLattice( candidateSet: make(map[common.Hash]*types.Block), ABS: make(map[common.Hash]map[types.ValidatorID]uint64), AHV: make(map[common.Hash]map[types.ValidatorID]uint64), + timestampEngine: *newConsensusTimestamp(), } } @@ -533,6 +537,13 @@ func (l *BlockLattice) totalOrdering(b *types.Block) { if len(output) > 0 { l.app.TotalOrderingDeliver(output, earlyDelivery) + blocksReady, _, err := l.timestampEngine.processBlocks(output) + if err != nil && err != ErrEmptyTimestamps { + panic(err) + } + for _, block := range blocksReady { + l.app.DeliverBlock(block.Hash, block.ConsensusTime) + } } // Rescan pending blocks to add into candidate set. |