code: func (jl *jsonLedger) initializeBlockHeight() {
  	infos, err := ioutil.ReadDir(jl.directory)
  	if err != nil {
  		logger.Panic(err)
  	}
  	nextNumber := uint64(0)
  	for _, info := range infos {
  		if info.IsDir() {
  			continue
  		}
  		var number uint64
  		_, err := fmt.Sscanf(info.Name(), blockFileFormatString, &number)
  		if err != nil {
  			continue
  		}
  		if number != nextNumber {
  			logger.Panicf("Missing block %d in the chain", nextNumber)
  		}
  		nextNumber++
  	}
  	jl.height = nextNumber
  	if jl.height == 0 {
  		return
  	}
  	block, found := jl.readBlock(jl.height - 1)
  	if !found {
  		logger.Panicf("Block %d was in directory listing but error reading", jl.height-1)
  	}
  	if block == nil {
  		logger.Panicf("Error reading block %d", jl.height-1)
  	}
  	jl.lastHash = block.Header.Hash()
  }
docs: // initializeBlockHeight verifies that all blocks exist between 0 and the block
  // height, and populates the lastHash