Skip anon user during trust calculation

This commit is contained in:
ekzyis 2023-07-22 15:58:02 +02:00
parent 6b4b5023f6
commit f0d0d07bad
1 changed files with 2 additions and 0 deletions

View File

@ -1,4 +1,5 @@
const math = require('mathjs')
const { ANON_USER_ID } = require('../lib/constants')
function trust ({ boss, models }) {
return async function () {
@ -158,6 +159,7 @@ async function storeTrust (models, nodeTrust) {
// convert nodeTrust into table literal string
let values = ''
for (const [id, trust] of Object.entries(nodeTrust)) {
if (id === ANON_USER_ID) continue
if (values) values += ','
values += `(${id}, ${trust})`
}