func (msg *MsgBlock) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
	err := writeBlockHeader(w, pver, &msg.Header)
	if err != nil {
		return err
	}

	err = WriteVarInt(w, pver, uint64(len(msg.Transactions)))
	if err != nil {
		return err
	}

	for _, tx := range msg.Transactions {
		err = tx.BtcEncode(w, pver, enc)
		if err != nil {
			return err
		}
	}

	if len(msg.Transactions) > 1 && msg.Transactions[1].IsCoinStake() {
		err = WriteVarBytes(w, pver, msg.BlockSignature)
		if err != nil {
			return err
		}
	}
	return nil
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
// This is part of the Message interface implementation.
// See Serialize for encoding blocks to be stored to disk, such as in a
// database, as opposed to encoding blocks for the wire.
BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
This is part of the Message interface implementation.
See Serialize for encoding blocks to be stored to disk, such as in a
database, as opposed to encoding blocks for the wire.
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding . // This is part of the Message interface implementation . // See Serialize for encoding blocks to be stored to disk such as in a // database as opposed to encoding blocks for the wire .
func (msg *MsgBlock) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
	err := writeBlockHeader(w, pver, &msg.Header)
	if err != nil {
		return err
	}
	err = WriteVarInt(w, pver, uint64(len(msg.Transactions)))
	if err != nil {
		return err
	}
	for _, tx := range msg.Transactions {
		err = tx.BtcEncode(w, pver, enc)
		if err != nil {
			return err
		}
	}
	if len(msg.Transactions) > 1 && msg.Transactions[1].IsCoinStake() {
		err = WriteVarBytes(w, pver, msg.BlockSignature)
		if err != nil {
			return err
		}
	}
	return nil
}
func ( msg * MsgBlock ) BtcEncode ( w io . Writer , pver uint32 , enc MessageEncoding ) error { err := writeBlockHeader ( w , pver , & msg . Header ) if err != nil { return err } err = WriteVarInt ( w , pver , uint64 ( len ( msg . Transactions ) ) ) if err != nil { return err } for _ , tx := range msg . Transactions { err = tx . BtcEncode ( w , pver , enc ) if err != nil { return err } } if len ( msg . Transactions ) > 1 && msg . Transactions [ 1 ] . IsCoinStake ( ) { err = WriteVarBytes ( w , pver , msg . BlockSignature ) if err != nil { return err } } return nil }
BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
BtcEncode encodes the receiver to w using the bitcoin protocol encoding .