code: func (b *fileBootstrapper) ReplaceGenesisBlockFile(block *cb.Block) error {
  	buff, marshalErr := proto.Marshal(block)
  	if marshalErr != nil {
  		return errors.Wrap(marshalErr, "could not marshal block into a []byte")
  	}
  
  	genFileStat, statErr := os.Stat(b.GenesisBlockFile)
  	if statErr != nil {
  		return errors.Wrapf(statErr, "could not get the os.Stat of the genesis block file: %s", b.GenesisBlockFile)
  	}
  
  	if !genFileStat.Mode().IsRegular() {
  		return errors.Errorf("genesis block file: %s, is not a regular file", b.GenesisBlockFile)
  	}
  
  	backupFile := b.GenesisBlockFile + ".bak"
  	if err := backupGenesisFile(b.GenesisBlockFile, backupFile); err != nil {
  		return errors.Wrapf(err, "could not copy genesis block file (%s) into backup file: %s",
  			b.GenesisBlockFile, backupFile)
  	}
  
  	if err := ioutil.WriteFile(b.GenesisBlockFile, buff, genFileStat.Mode()); err != nil {
  		return errors.Wrapf(err, "could not write new genesis block into file: %s; use backup if necessary: %s",
  			b.GenesisBlockFile, backupFile)
  	}
  
  	return nil
  }
docs: // ReplaceGenesisBlockFile creates a backup of the genesis block file, and then replaces
  // it with the content of the given block.
  // This is used during consensus-type migration in order to generate a bootstrap file that
  // specifies the new consensus-type.