OSDN Git Service

Fix fastsync require block 0 err v1.0.5-alpha
authorYahtoo Ma <yahtoo.ma@gmail.com>
Thu, 30 Aug 2018 11:02:27 +0000 (19:02 +0800)
committerYahtoo Ma <yahtoo.ma@gmail.com>
Thu, 30 Aug 2018 11:02:27 +0000 (19:02 +0800)
netsync/block_keeper.go

index 5d14091..d06348c 100644 (file)
@@ -162,6 +162,9 @@ func (bk *blockKeeper) fastBlockSync(checkPoint *consensus.Checkpoint) error {
 
        fastHeader := bk.headerList.Front()
        for bk.chain.BestBlockHeight() <= checkPoint.Height {
+               if bk.chain.BestBlockHeight() == 0 {
+                       fastHeader = fastHeader.Next()
+               }
                hash := fastHeader.Value.(*types.BlockHeader).Hash()
                merkleBlock, err := bk.requireMerkleBlock(fastHeader.Value.(*types.BlockHeader).Height, &hash)
                if err != nil {