From 376c6aa8f3f6c59837af790975e7a66df84658ab Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Mon, 21 Nov 2022 22:40:38 +0200 Subject: [PATCH] Check rule errors when validating blocks with trusted data --- .../flows/v5/blockrelay/ibd_with_headers_proof.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/protocol/flows/v5/blockrelay/ibd_with_headers_proof.go b/app/protocol/flows/v5/blockrelay/ibd_with_headers_proof.go index 2ad059a0e..455b1c2dc 100644 --- a/app/protocol/flows/v5/blockrelay/ibd_with_headers_proof.go +++ b/app/protocol/flows/v5/blockrelay/ibd_with_headers_proof.go @@ -286,7 +286,13 @@ func (flow *handleIBDFlow) processBlockWithTrustedData( } err := consensus.ValidateAndInsertBlockWithTrustedData(blockWithTrustedData, false) - return err + if err != nil { + if errors.As(err, &ruleerrors.RuleError{}) { + return protocolerrors.Wrapf(true, err, "failed validating block with trusted data") + } + return err + } + return nil } func (flow *handleIBDFlow) receiveBlockWithTrustedData() (*appmessage.MsgBlockWithTrustedDataV4, bool, error) {