code: func WriteHeader(db ethdb.Writer, header *types.Header) {
  	// Write the hash -> number mapping
  	var (
  		hash    = header.Hash()
  		number  = header.Number.Uint64()
  		encoded = encodeBlockNumber(number)
  	)
  	key := headerNumberKey(hash)
  	if err := db.Put(key, encoded); err != nil {
  		log.Crit("Failed to store hash to number mapping", "err", err)
  	}
  	// Write the encoded header
  	data, err := rlp.EncodeToBytes(header)
  	if err != nil {
  		log.Crit("Failed to RLP encode header", "err", err)
  	}
  	key = headerKey(number, hash)
  	if err := db.Put(key, data); err != nil {
  		log.Crit("Failed to store header", "err", err)
  	}
  }
docs: // WriteHeader stores a block header into the database and also stores the hash-
  // to-number mapping.