core: insert less length zero chains
This reduces the amount of queueEvents that are sent internally.
This commit is contained in:
parent
e7e2cbfc01
commit
55b60e699b
@ -522,14 +522,15 @@ type queueEvent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *ChainManager) procFutureBlocks() {
|
func (self *ChainManager) procFutureBlocks() {
|
||||||
blocks := []*types.Block{}
|
var blocks []*types.Block
|
||||||
self.futureBlocks.Each(func(i int, block *types.Block) {
|
self.futureBlocks.Each(func(i int, block *types.Block) {
|
||||||
blocks = append(blocks, block)
|
blocks = append(blocks, block)
|
||||||
})
|
})
|
||||||
|
if len(blocks) > 0 {
|
||||||
types.BlockBy(types.Number).Sort(blocks)
|
types.BlockBy(types.Number).Sort(blocks)
|
||||||
self.InsertChain(blocks)
|
self.InsertChain(blocks)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// InsertChain will attempt to insert the given chain in to the canonical chain or, otherwise, create a fork. It an error is returned
|
// InsertChain will attempt to insert the given chain in to the canonical chain or, otherwise, create a fork. It an error is returned
|
||||||
// it will return the index number of the failing block as well an error describing what went wrong (for possible errors see core/errors.go).
|
// it will return the index number of the failing block as well an error describing what went wrong (for possible errors see core/errors.go).
|
||||||
|
Loading…
Reference in New Issue
Block a user