Compare commits

...

3 Commits

Author SHA1 Message Date
Jacob Karlsson af8a2bf4ec 1.0.1 2024-06-09 16:58:03 +02:00
Powersource 4a890ae8b6 Merge pull request 'Fix null erasable throw' (#2) from null-erasables into master
Reviewed-on: https://codeberg.org/pzp/pzp-goals/pulls/2
2024-06-09 14:56:00 +00:00
Jacob Karlsson 4b8bc8d285 Fix null erasable throw 2024-06-09 13:58:34 +02:00
2 changed files with 7 additions and 7 deletions

View File

@ -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<ReturnType<PZPDB['getTangle']>>} 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']
}

View File

@ -1,6 +1,6 @@
{
"name": "pzp-goals",
"version": "1.0.0",
"version": "1.0.1",
"description": "PZP tracker of replication goals",
"author": "Andre Staltz <contact@staltz.com>",
"license": "MIT",
@ -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",