refactoring to accomodate the bls message changes in the spec
This commit is contained in:
@@ -71,6 +71,7 @@ func init() {
|
||||
}, nil
|
||||
})).
|
||||
Complete())
|
||||
cbor.RegisterCborType(MsgMeta{})
|
||||
}
|
||||
|
||||
type Ticket []byte
|
||||
@@ -98,6 +99,11 @@ type BlockHeader struct {
|
||||
MessageReceipts cid.Cid
|
||||
}
|
||||
|
||||
type MsgMeta struct {
|
||||
BlsMessages cid.Cid
|
||||
SecpkMessages cid.Cid
|
||||
}
|
||||
|
||||
func (b *BlockHeader) ToStorageBlock() (block.Block, error) {
|
||||
data, err := b.Serialize()
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,9 @@ package types
|
||||
import "github.com/ipfs/go-cid"
|
||||
|
||||
type FullBlock struct {
|
||||
Header *BlockHeader
|
||||
Messages []*SignedMessage
|
||||
Header *BlockHeader
|
||||
BlsMessages []*Message
|
||||
SecpkMessages []*SignedMessage
|
||||
}
|
||||
|
||||
func (fb *FullBlock) Cid() cid.Cid {
|
||||
|
||||
@@ -114,3 +114,12 @@ func (m *Message) ToStorageBlock() (block.Block, error) {
|
||||
|
||||
return block.NewBlockWithCid(data, c)
|
||||
}
|
||||
|
||||
func (m *Message) Cid() cid.Cid {
|
||||
b, err := m.ToStorageBlock()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to marshal message: %s", err))
|
||||
}
|
||||
|
||||
return b.Cid()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user