diff options
author | Felix Lange <fjl@twurst.com> | 2015-05-30 00:55:42 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-06-01 18:48:12 +0800 |
commit | 55b60e699b3ab381b4576d1a02337704b0f74c74 (patch) | |
tree | deb0fcf3df3c502fa934b40dbfdf5005c040a6dd | |
parent | e7e2cbfc018f5e0353d26b94ff785a206c9a16c4 (diff) | |
download | dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar.gz dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar.bz2 dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar.lz dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar.xz dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.tar.zst dexon-55b60e699b3ab381b4576d1a02337704b0f74c74.zip |
core: insert less length zero chains
This reduces the amount of queueEvents that are sent internally.
-rw-r--r-- | core/chain_manager.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index a785e1854..927055103 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -522,13 +522,14 @@ type queueEvent struct { } func (self *ChainManager) procFutureBlocks() { - blocks := []*types.Block{} + var blocks []*types.Block self.futureBlocks.Each(func(i int, block *types.Block) { blocks = append(blocks, block) }) - - types.BlockBy(types.Number).Sort(blocks) - self.InsertChain(blocks) + if len(blocks) > 0 { + types.BlockBy(types.Number).Sort(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 |