remove dead comments

This commit is contained in:
Andre Staltz 2023-04-18 20:34:46 +03:00
parent f1e313461e
commit d040da5409
3 changed files with 10 additions and 46 deletions

View File

@ -70,33 +70,6 @@ function isEmptyObject(obj) {
* @property {string} keys.private
*/
/**
* @param {Msg} msg
*/
// function getFeedId(msg) {
// if (msg.metadata.type) {
// return `ppppp:feed/v1/${msg.metadata.who}/${msg.metadata.type}`
// } else {
// return `ppppp:feed/v1/${msg.metadata.who}`
// }
// }
// function isMsg(x) {
// return (
// typeof x === 'object' &&
// !!x &&
// typeof x.metadata.author === 'string' &&
// x.metadata.author &&
// typeof x.metadata.type === 'string' &&
// x.metadata.type
// )
// }
// function isFeedId(author) {
// if (typeof author !== 'string') return false
// return author.startsWith('ppppp:feed/v1/')
// }
function isFeedRoot(msg, authorId, findType) {
const findWho = stripAuthor(authorId)
const { who, type, tangles } = msg.metadata
@ -231,9 +204,6 @@ module.exports = {
getMsgId,
isFeedRoot,
getFeedRootHash,
// getFeedId,
// isFeedId,
// isMsg,
create,
createRoot,
erase,

View File

@ -229,6 +229,16 @@ class Tangle {
getMaxDepth() {
return this.#maxDepth
}
debug() {
let str = ''
const max = this.#maxDepth
for (let i = 0; i <= max; i++) {
const atDepth = this.#getAllAtDepth(i)
str += `Depth ${i}: ${atDepth.join(', ')}\n`
}
return str
}
}
module.exports = Tangle

View File

@ -40,7 +40,6 @@ function validateWho(msg) {
} catch (err) {
return new Error('invalid message: must have "who" as base58 string')
}
// FIXME: if there are prev, then `who` must match
}
function validateMsgHash(str) {
@ -199,8 +198,6 @@ function validateContent(msg) {
}
}
// FIXME: validateDepth should be +1 of the max of prev depth
function validate(msg, tangle, msgHash, rootHash) {
let err
if ((err = validateShape(msg))) return err
@ -214,22 +211,9 @@ function validate(msg, tangle, msgHash, rootHash) {
if ((err = validateSignature(msg))) return err
}
// function validateBatch(nativeMsgs, prevNativeMsg, hmacKey, cb) {
// let err
// let prev = prevNativeMsg
// for (const nativeMsg of nativeMsgs) {
// err = validateSync(nativeMsg, prev, hmacKey)
// if (err) return cb(err)
// prev = nativeMsg
// }
// cb()
// }
module.exports = {
validateType,
validateContent,
validate,
validateMsgHash,
// validateBatch,
}