code: func (msg *MsgHeaders) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
  	// Limit to max block headers per message.
  	count := len(msg.Headers)
  	if count > MaxBlockHeadersPerMsg {
  		str := fmt.Sprintf("too many block headers for message "+
  			"[count %v, max %v]", count, MaxBlockHeadersPerMsg)
  		return messageError("MsgHeaders.BtcEncode", str)
  	}
  
  	err := WriteVarInt(w, pver, uint64(count))
  	if err != nil {
  		return err
  	}
  
  	for _, bh := range msg.Headers {
  		err := writeBlockHeader(w, pver, bh)
  		if err != nil {
  			return err
  		}
  
  		// The wire protocol encoding always includes a 0 for the number
  		// of transactions on header messages.  This is really just an
  		// artifact of the way the original implementation serializes
  		// block headers, but it is required.
  		err = WriteVarInt(w, pver, 0)
  		if err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
  // This is part of the Message interface implementation.