From 95cff55e6ce3b4e1a8016ba54fd4560701053fa5 Mon Sep 17 00:00:00 2001 From: Alexander Zavorotynskiy Date: Wed, 24 Aug 2022 15:25:16 +0200 Subject: [PATCH] feat(backend): skip raw batch when get incorrect batch version --- backend/pkg/messages/batch.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/pkg/messages/batch.go b/backend/pkg/messages/batch.go index f6f1e23ff..2b4bc0eea 100644 --- a/backend/pkg/messages/batch.go +++ b/backend/pkg/messages/batch.go @@ -98,7 +98,10 @@ func (i *iteratorImpl) Next() bool { i.version = m.Version isBatchMeta = true log.Printf("new batch version: %d", i.version) - + if i.version > 1 { + log.Printf("incorrect batch version, skip current batch") + return false + } case MsgBatchMeta: // Is not required to be present in batch since IOS doesn't have it (though we might change it) if i.index != 0 { // Might be several 0-0 BatchMeta in a row without an error though log.Printf("Batch Meta found at the end of the batch")