diff options
author | Wei-Ning Huang <w@byzantine-lab.io> | 2019-08-22 22:43:15 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-17 16:57:31 +0800 |
commit | f3a8bd79153cdce70a9d189c45aa3880a5548d70 (patch) | |
tree | a886922c40328a939231a505a0d7ccb82765bce9 | |
parent | 0594f51ee194bc975a75d293a789d98f47f3f4d9 (diff) | |
download | go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar.gz go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar.bz2 go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar.lz go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar.xz go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.tar.zst go-tangerine-f3a8bd79153cdce70a9d189c45aa3880a5548d70.zip |
dex: minor fix to core block syncing
-rw-r--r-- | dex/blockproposer.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dex/blockproposer.go b/dex/blockproposer.go index 0ba45b30a..486d4756f 100644 --- a/dex/blockproposer.go +++ b/dex/blockproposer.go @@ -148,7 +148,7 @@ func (b *blockProposer) syncConsensus() (*dexCore.Consensus, error) { blocksToSync := func(coreHeight, height uint64) []*coreTypes.Block { var blocks []*coreTypes.Block - for coreHeight < height { + for len(blocks) < 1024 && coreHeight < height { var block coreTypes.Block b := b.dex.blockchain.GetBlockByNumber(coreHeight + 1) if err := rlp.DecodeBytes(b.Header().DexconMeta, &block); err != nil { @@ -203,9 +203,11 @@ ListenLoop: for { select { case ev := <-ch: - blocks := blocksToSync(coreHeight, ev.Block.NumberU64()) - - if len(blocks) > 0 { + for { + blocks := blocksToSync(coreHeight, ev.Block.NumberU64()) + if len(blocks) == 0 { + break + } b.watchCat.Feed(blocks[len(blocks)-1].Position) log.Debug("Filling compaction chain", "num", len(blocks), "first", blocks[0].Position.Height, |