aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockpool.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-18 15:00:27 +0800
committerhaoping-ku <37325897+haoping-ku@users.noreply.github.com>2018-10-18 15:00:27 +0800
commit43299221c586bfb55e225799aedc6d133ba97c3f (patch)
treee607424430237698c4eb8f33e186643fc5849ca6 /core/blockpool.go
parent8303e9d054957195717f41804a456e2720b0c4bb (diff)
downloaddexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar.gz
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar.bz2
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar.lz
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar.xz
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.tar.zst
dexon-consensus-43299221c586bfb55e225799aedc6d133ba97c3f.zip
core: total ordering flush (#212)
* Implement flush * Panic for all errors from total-ordering * Fix test failure All DAGs generated by blocks-generator would trigger round switching. * Add NewBlocksGeneratorConfig * Add test caes for numChains changes * Resize internal structures * Perform total ordering based on current numChains * Fix not a valid DAG checking * Comparing blocks by height is not correct * Fix blocks from future round are delivered first by revealer * Make sure only picking one candidate in one chain. Blocks on the same chain in different rounds would not have acking relation. * Fix stuffs * Fix the issue that two candidates from the same chain are picked. * Rework candidateChainMapping * Add test case for phi, k changed * Refine testing code for round change * Add breakpoints in global vector * Remove not a valid dag checking. * Adding comments * Add check to forward acking * Fix vet failure * Prepareing height record with breakpoint * Fixup: add check to make sure delivered round IDs are increasing.
Diffstat (limited to 'core/blockpool.go')
-rw-r--r--core/blockpool.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/blockpool.go b/core/blockpool.go
index cece34d..7441cf9 100644
--- a/core/blockpool.go
+++ b/core/blockpool.go
@@ -25,7 +25,7 @@ import (
// blockPool is a slice of heap of blocks, indexed by chainID,
// and the heap is sorted based on heights of blocks.
-type blockPool []types.ByHeight
+type blockPool []types.ByPosition
// newBlockPool constructs a blockPool.
func newBlockPool(chainNum uint32) (pool blockPool) {
@@ -41,10 +41,10 @@ func (p *blockPool) resize(num uint32) {
if uint32(len(*p)) < num {
return
}
- newPool := make([]types.ByHeight, num)
+ newPool := make([]types.ByPosition, num)
copy(newPool, *p)
for i := uint32(len(*p)); i < num; i++ {
- newChain := types.ByHeight{}
+ newChain := types.ByPosition{}
heap.Init(&newChain)
newPool[i] = newChain
}