Commit 55b60e69 authored by Felix Lange's avatar Felix Lange

core: insert less length zero chains

This reduces the amount of queueEvents that are sent internally.
parent e7e2cbfc
...@@ -522,13 +522,14 @@ type queueEvent struct { ...@@ -522,13 +522,14 @@ 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment