From 56b8f311f305f43e105f0628be846eabe0e8c467 Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Wed, 2 Dec 2020 18:24:48 +0400 Subject: [PATCH] Fix signature verify address issue --- consensus/pre_prepare_pool.go | 4 +++- consensus/utils.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/consensus/pre_prepare_pool.go b/consensus/pre_prepare_pool.go index 1c4642f..dac6056 100644 --- a/consensus/pre_prepare_pool.go +++ b/consensus/pre_prepare_pool.go @@ -4,6 +4,8 @@ import ( "bytes" "fmt" + rtypes "github.com/Secured-Finance/dione/rpc/types" + ftypes "github.com/Secured-Finance/dione/rpc/filecoin/types" oracleEmitter "github.com/Secured-Finance/dione/contracts/oracleemitter" @@ -166,7 +168,7 @@ func (ppp *PrePreparePool) IsValidPrePrepare(prePrepare *types2.Message) bool { ////////////////////////////////////// // === verify filecoin message signature === - if consensusMsg.Task.RequestType == "GetTransaction" && consensusMsg.Task.OriginChain == 1 { + if consensusMsg.Task.OriginChain == rtypes.RPCTypeFilecoin && consensusMsg.Task.RequestType == "getTransaction" { var msg ftypes.SignedMessage if err := msg.UnmarshalCBOR(bytes.NewReader(consensusMsg.Task.Payload)); err != nil { if err := msg.Message.UnmarshalCBOR(bytes.NewReader(consensusMsg.Task.Payload)); err != nil { diff --git a/consensus/utils.go b/consensus/utils.go index 87e67f4..d0a4564 100644 --- a/consensus/utils.go +++ b/consensus/utils.go @@ -16,7 +16,7 @@ func verifyTaskSignature(msg types.ConsensusMessage) error { } err = sigs.Verify( &types2.Signature{Type: types2.SigTypeEd25519, Data: msg.Signature}, - []byte(msg.Task.Miner.String()), + []byte(msg.Task.Miner), []byte(fmt.Sprintf("%v", cHash)), ) if err != nil {