From eec6eb96693b89be3bf4066eeb728d28055cd072 Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Mon, 21 Nov 2022 23:06:00 +0200 Subject: [PATCH] Check rule errors when validating blocks with trusted data (#2171) --- .../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 2ad059a0e0..455b1c2dc5 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) {