From 4b8bc8d285d0d11d51da61ec4e82ca8b488392eb Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Sun, 9 Jun 2024 13:58:34 +0200 Subject: [PATCH] Fix null erasable throw --- lib/index.js | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 5a9e9c5..feafa16 100644 --- a/lib/index.js +++ b/lib/index.js @@ -18,7 +18,7 @@ const p = (fn) => (...args) => { * @typedef {import('pzp-db').RecPresent} RecPresent * @typedef {import('pzp-db').Tangle} Tangle * @typedef {import('pzp-db').Msg} Msg - * @typedef {NonNullable>} DBTangle + * @typedef {import('pzp-db/db-tangle')} DBTangle * @typedef {string} MsgID * @typedef {'none'|'all'|`newest-${number}`|'dict'|'set'} GoalDSL * @typedef {'none'|'all'|'newest'|'dict'|'set'} GoalType @@ -288,12 +288,12 @@ function initGoals(peer, config) { // (Loop again with heavy computations now that it's inevitable:) for (const [ tangle, min] of validTangles) { const minMsgIDs = tangle - // @ts-ignore .topoSort() - // @ts-ignore .filter((msgID) => tangle.getDepth(msgID) === min) - // @ts-ignore - const { erasables } = tangle.getDeletablesAndErasables(...minMsgIDs) + const deletablesErasables = tangle.getDeletablesAndErasables(...minMsgIDs) + // TODO: returning 'trail' to be on the safe side and not throw away too much. but i'm confused why the algo would've gotten this far but then this still manages to be null + if (!deletablesErasables) return ['trail'] + const { erasables } = deletablesErasables if (erasables.has(msgID)) return ['trail'] } diff --git a/package.json b/package.json index e79a0f3..556e4ee 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "bs58": "^5.0.0", "c8": "7", "pzp-caps": "^1.0.0", - "pzp-db": "^1.0.1", + "pzp-db": "^1.0.4", "pzp-dict": "^1.0.0", "pzp-keypair": "^1.0.0", "pzp-set": "^1.0.0",