mirror of https://codeberg.org/pzp/pzp-goals.git
Merge pull request 'Fix null erasable throw' (#2) from null-erasables into master
Reviewed-on: https://codeberg.org/pzp/pzp-goals/pulls/2
This commit is contained in:
commit
4a890ae8b6
10
lib/index.js
10
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<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']
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue