Fix minRequiredDepth() validation

This commit is contained in:
Andre Staltz 2023-11-24 15:07:03 +02:00
parent 0823473b18
commit a2627e44ae
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 5 additions and 2 deletions

View File

@ -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()