mirror of https://codeberg.org/pzp/pzp-db.git
refactor: simplify some code in MsgV3
This commit is contained in:
parent
accc41a68c
commit
9223402335
|
@ -151,15 +151,13 @@ function create(opts) {
|
|||
const accountTips = opts.accountTips ? opts.accountTips.sort() : null
|
||||
|
||||
const tangles = /** @type {Msg['metadata']['tangles']} */ ({})
|
||||
if (opts.tangles) {
|
||||
for (const rootID in opts.tangles) {
|
||||
if ((err = validateMsgID(rootID))) throw err
|
||||
const tangle = opts.tangles[rootID]
|
||||
const depth = tangle.maxDepth + 1
|
||||
const lipmaaSet = tangle.getLipmaaSet(depth)
|
||||
const prev = [...union(lipmaaSet, tangle.tips)].sort()
|
||||
tangles[rootID] = { depth, prev }
|
||||
}
|
||||
for (const rootID in opts.tangles) {
|
||||
if ((err = validateMsgID(rootID))) throw err
|
||||
const tangle = opts.tangles[rootID]
|
||||
const depth = tangle.maxDepth + 1
|
||||
const lipmaaSet = tangle.getLipmaaSet(depth)
|
||||
const prev = [...union(lipmaaSet, tangle.tips)].sort()
|
||||
tangles[rootID] = { depth, prev }
|
||||
}
|
||||
|
||||
/** @type {Msg} */
|
||||
|
|
Loading…
Reference in New Issue