Fix filecoin tx unmarshalling

This commit is contained in:
ChronosX88 2020-12-12 16:44:01 +04:00
parent b4f5f3fb7d
commit 63e297a03b
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A
3 changed files with 8 additions and 16 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/Secured-Finance/dione/cache"
"github.com/Secured-Finance/dione/consensus/validation"
_ "github.com/Secured-Finance/dione/consensus/validation/filecoin" // enable filecoin validation
"github.com/filecoin-project/go-state-types/crypto"
types2 "github.com/Secured-Finance/dione/consensus/types"

View File

@ -21,7 +21,7 @@ func ValidateGetTransaction(payload []byte) error {
}
if msg.Type == ftypes.MessageTypeSecp256k1 {
if err := sigs.Verify(msg.Signature, msg.Message.From.Bytes(), msg.Message.Cid().Bytes()); err != nil {
if err := sigs.Verify(&msg.Signature, msg.Message.From.Bytes(), msg.Message.Cid().Bytes()); err != nil {
logrus.Errorf("Couldn't verify transaction %v", err)
return xerrors.Errorf("Couldn't verify transaction: %v")
}

View File

@ -12,7 +12,7 @@ import (
type SignedMessage struct {
Message ltypes.Message
Signature *types.Signature
Signature types.Signature
Type MessageType
}
@ -41,8 +41,6 @@ func (t MessageType) Name() (string, error) {
// CBOR operations from lotus
func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error {
*t = SignedMessage{}
br := cbg.GetPeeker(r)
scratch := make([]byte, 8)
@ -58,21 +56,14 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields")
}
{
if err := t.Message.UnmarshalCBOR(br); err != nil {
return fmt.Errorf("unmarshaling t.Message: %w", err)
}
if err := t.Message.UnmarshalCBOR(br); err != nil {
return fmt.Errorf("unmarshaling t.Message: %w", err)
}
{
if err := t.Signature.UnmarshalCBOR(br); err != nil {
return fmt.Errorf("unmarshaling t.Signature: %w", err)
}
if err := t.Signature.UnmarshalCBOR(br); err != nil {
return fmt.Errorf("unmarshaling t.Signature: %w", err)
}
return nil
}