Consensus: Safety check against unknown sig types

This commit is contained in:
Aayush Rajasekaran 2021-09-10 17:47:12 -04:00 committed by Jennifer Wang
parent d83d585327
commit 518634b998

View File

@ -65,7 +65,7 @@ func (filec *FilecoinEC) CreateBlock(ctx context.Context, w api.Wallet, bt *api.
} }
blsMsgCids = append(blsMsgCids, c) blsMsgCids = append(blsMsgCids, c)
} else { } else if msg.Signature.Type == crypto.SigTypeSecp256k1 {
c, err := filec.sm.ChainStore().PutMessage(msg) c, err := filec.sm.ChainStore().PutMessage(msg)
if err != nil { if err != nil {
return nil, err return nil, err
@ -74,6 +74,8 @@ func (filec *FilecoinEC) CreateBlock(ctx context.Context, w api.Wallet, bt *api.
secpkMsgCids = append(secpkMsgCids, c) secpkMsgCids = append(secpkMsgCids, c)
secpkMessages = append(secpkMessages, msg) secpkMessages = append(secpkMessages, msg)
} else {
return nil, xerrors.Errorf("unknown sig type: %d", msg.Signature.Type)
} }
} }