func (msg *MsgBlock) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error {
	err := readBlockHeader(r, pver, &msg.Header)
	if err != nil {
		return err
	}

	txCount, err := ReadVarInt(r, pver)
	if err != nil {
		return err
	}

	// Prevent more transactions than could possibly fit into a block.
	// It would be possible to cause memory exhaustion and panics without
	// a sane upper bound on this count.
	if txCount > maxTxPerBlock {
		str := fmt.Sprintf("too many transactions to fit into a block "+
			"[count %d, max %d]", txCount, maxTxPerBlock)
		return messageError("MsgBlock.BtcDecode", str)
	}

	msg.Transactions = make([]*MsgTx, 0, txCount)
	for i := uint64(0); i < txCount; i++ {
		tx := MsgTx{}
		err := tx.BtcDecode(r, pver, enc)
		if err != nil {
			return err
		}
		msg.Transactions = append(msg.Transactions, &tx)
	}

	return nil
}
// BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
// This is part of the Message interface implementation.
// See Deserialize for decoding blocks stored to disk, such as in a database, as
// opposed to decoding blocks from the wire.
BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
This is part of the Message interface implementation.
See Deserialize for decoding blocks stored to disk, such as in a database, as
opposed to decoding blocks from the wire.
// BtcDecode decodes r using the bitcoin protocol encoding into the receiver . // This is part of the Message interface implementation . // See Deserialize for decoding blocks stored to disk such as in a database as // opposed to decoding blocks from the wire .
func (msg *MsgBlock) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error {
	err := readBlockHeader(r, pver, &msg.Header)
	if err != nil {
		return err
	}
	txCount, err := ReadVarInt(r, pver)
	if err != nil {
		return err
	}
	if txCount > maxTxPerBlock {
		str := fmt.Sprintf("too many transactions to fit into a block "+
			"[count %d, max %d]", txCount, maxTxPerBlock)
		return messageError("MsgBlock.BtcDecode", str)
	}
	msg.Transactions = make([]*MsgTx, 0, txCount)
	for i := uint64(0); i < txCount; i++ {
		tx := MsgTx{}
		err := tx.BtcDecode(r, pver, enc)
		if err != nil {
			return err
		}
		msg.Transactions = append(msg.Transactions, &tx)
	}
	return nil
}
func ( msg * MsgBlock ) BtcDecode ( r io . Reader , pver uint32 , enc MessageEncoding ) error { err := readBlockHeader ( r , pver , & msg . Header ) if err != nil { return err } txCount , err := ReadVarInt ( r , pver ) if err != nil { return err } if txCount > maxTxPerBlock { str := fmt . Sprintf ( " " + " " , txCount , maxTxPerBlock ) return messageError ( " " , str ) } msg . Transactions = make ( [ ] * MsgTx , 0 , txCount ) for i := uint64 ( 0 ) ; i < txCount ; i ++ { tx := MsgTx { } err := tx . BtcDecode ( r , pver , enc ) if err != nil { return err } msg . Transactions = append ( msg . Transactions , & tx ) } return nil }
BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
BtcDecode decodes r using the bitcoin protocol encoding into the receiver .
// Prevent more transactions than could possibly fit into a block. // It would be possible to cause memory exhaustion and panics without // a sane upper bound on this count.