Skip to content

Commit

Permalink
fixed startup bug that causes error at block 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger5226 committed Feb 5, 2019
1 parent 913b973 commit e3efd37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon/processing/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func checkHandleReorg(height uint64, chainPrevHash string) (uint64, error) {
return height, errors.Prefix("error getting block@"+strconv.Itoa(int(prevHeight))+": ", err)
}
//Recursively delete blocks until they match or a reorg of depth 100 == failure of logic.
for prevBlock.Hash != chainPrevHash && depth < 100 {
for prevBlock.Hash != chainPrevHash && depth < 100 && prevHeight > 0 {
// Delete because it needs to be reprocessed due to reorg
logrus.Println("block ", prevBlock.Hash, " at height ", prevBlock.Height,
" to be removed due to reorg. TX-> ", prevBlock.TransactionHashes)
Expand Down

0 comments on commit e3efd37

Please sign in to comment.