From 73fbe5c3378160f84f81414fbf746e9628381051 Mon Sep 17 00:00:00 2001 From: Ivan FB <128452529+Ivansete-status@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:12:31 +0200 Subject: [PATCH] postgres_driver limit max num hashes to 100 (#2976) --- waku/waku_archive/driver/postgres_driver/postgres_driver.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/waku/waku_archive/driver/postgres_driver/postgres_driver.nim b/waku/waku_archive/driver/postgres_driver/postgres_driver.nim index 559fd0be3..e76806ae2 100644 --- a/waku/waku_archive/driver/postgres_driver/postgres_driver.nim +++ b/waku/waku_archive/driver/postgres_driver/postgres_driver.nim @@ -815,6 +815,10 @@ method getMessages*( ): Future[ArchiveDriverResult[seq[ArchiveRow]]] {.async.} = debug "beginning of getMessages" + const MAX_ALLOWED_HASHES = 100 + if hashes.len > MAX_ALLOWED_HASHES: + return err(fmt"can not attend queries with more than {MAX_ALLOWED_HASHES} hashes") + let hexHashes = hashes.mapIt(toHex(it)) if cursor.isNone() and pubsubTopic.isNone() and contentTopics.len == 0 and