package chain import ( "bytes" "github.com/ipfs/go-cid" "github.com/filecoin-project/go-lotus/chain/types" ) type BlockMsg struct { Header *types.BlockHeader BlsMessages []cid.Cid SecpkMessages []cid.Cid } func DecodeBlockMsg(b []byte) (*BlockMsg, error) { var bm BlockMsg if err := bm.UnmarshalCBOR(bytes.NewReader(b)); err != nil { return nil, err } return &bm, nil } func (bm *BlockMsg) Cid() cid.Cid { return bm.Header.Cid() } func (bm *BlockMsg) Serialize() ([]byte, error) { buf := new(bytes.Buffer) if err := bm.MarshalCBOR(buf); err != nil { return nil, err } return buf.Bytes(), nil }