Fix filecoin tx unmarshalling
This commit is contained in:
parent
b4f5f3fb7d
commit
63e297a03b
@ -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"
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user