refactoring to accomodate the bls message changes in the spec

This commit is contained in:
whyrusleeping
2019-08-01 18:19:22 -07:00
parent db005e99e0
commit dc7c0fcabe
15 changed files with 368 additions and 117 deletions
+6
View File
@@ -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 -2
View File
@@ -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 {
+9
View File
@@ -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()
}