From e3ce7f4175d4848d28c9f789256ba945fc708afa Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Thu, 3 Dec 2020 01:21:10 +0400 Subject: [PATCH] Add warning when we don't have payload validation for specific request --- consensus/pre_prepare_pool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/consensus/pre_prepare_pool.go b/consensus/pre_prepare_pool.go index 6d1d0ec..34f90e8 100644 --- a/consensus/pre_prepare_pool.go +++ b/consensus/pre_prepare_pool.go @@ -4,8 +4,6 @@ import ( "fmt" "github.com/Secured-Finance/dione/consensus/validation" - rtypes "github.com/Secured-Finance/dione/rpc/types" - oracleEmitter "github.com/Secured-Finance/dione/contracts/oracleemitter" "github.com/Secured-Finance/dione/node" @@ -166,11 +164,13 @@ func (ppp *PrePreparePool) IsValidPrePrepare(prePrepare *types2.Message) bool { ////////////////////////////////////// // === validate payload by specific-chain checks === - if validationFunc := validation.GetValidationMethod(rtypes.RPCTypeFilecoin, consensusMsg.Task.RequestType); validationFunc != nil { + if validationFunc := validation.GetValidationMethod(consensusMsg.Task.OriginChain, consensusMsg.Task.RequestType); validationFunc != nil { err := validationFunc(consensusMsg.Task.Payload) if err != nil { logrus.Errorf("payload validation has failed: %v", err) } + } else { + logrus.Warnf("Origin chain [%v]/request type[%v] doesn't have any payload validation!", consensusMsg.Task.OriginChain, consensusMsg.Task.RequestType) } /////////////////////////////////