mirror of https://codeberg.org/pzp/pzp-db.git
fix minor Tangle class issues
This commit is contained in:
parent
75b36e9730
commit
b87ca604eb
|
@ -224,8 +224,7 @@ class Tangle {
|
||||||
|
|
||||||
get root() {
|
get root() {
|
||||||
if (!this.#rootMsg) {
|
if (!this.#rootMsg) {
|
||||||
console.trace('Tangle is missing root message')
|
throw new Error(`Tangle "${this.#rootID}" is missing root message`)
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
return this.#rootMsg
|
return this.#rootMsg
|
||||||
}
|
}
|
||||||
|
@ -298,7 +297,8 @@ class Tangle {
|
||||||
if (msgBID === this.#rootID) return false
|
if (msgBID === this.#rootID) return false
|
||||||
let toCheck = [msgBID]
|
let toCheck = [msgBID]
|
||||||
while (toCheck.length > 0) {
|
while (toCheck.length > 0) {
|
||||||
const prev = this.#prev.get(/** @type {string} */ (toCheck.shift()))
|
const checking = /** @type {string} */ (toCheck.shift())
|
||||||
|
const prev = this.#prev.get(checking)
|
||||||
if (!prev) continue
|
if (!prev) continue
|
||||||
if (prev.includes(msgAID)) return true
|
if (prev.includes(msgAID)) return true
|
||||||
toCheck.push(...prev)
|
toCheck.push(...prev)
|
||||||
|
|
Loading…
Reference in New Issue