From a2627e44aec9cc072884eca93f4e537e51cfdc01 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Fri, 24 Nov 2023 15:07:03 +0200 Subject: [PATCH] Fix minRequiredDepth() validation --- lib/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index b4b4afa..12ff695 100644 --- a/lib/index.js +++ b/lib/index.js @@ -454,9 +454,12 @@ function initSet(peer, config) { const tangle = peer.db.getTangle(tangleID) // prettier-ignore - if (!tangle || tangle.size === 0) throw new Error(`isGhostable() tangleID "${tangleID}" is empty`) + if (!tangle || tangle.size === 0) throw new Error(`Tangle "${tangleID}" is locally unknown`) // prettier-ignore - if (!isValidSetMoot(tangle.root)) throw new Error(`minRequiredDepth() "${tangleID}" is not a Set moot`) + if (!MsgV3.isMoot(tangle.root)) throw new Error(`Tangle "${tangleID}" is not a moot`) + const domain = tangle.root.metadata.domain + // prettier-ignore + if (!domain.startsWith(PREFIX)) throw new Error(`Tangle "${tangleID}" is not a Set moot`) // Discover item roots const itemRoots = new Set()