From 7c7d01aa919db0609879fdb78e2c79ab7b85c9d7 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Sun, 8 Jan 2023 13:34:26 -0600 Subject: [PATCH] Use adjusted increment value for author reputation awards --- forum-network/src/classes/forum.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/forum-network/src/classes/forum.js b/forum-network/src/classes/forum.js index 1ae6eab..1c4d263 100644 --- a/forum-network/src/classes/forum.js +++ b/forum-network/src/classes/forum.js @@ -89,9 +89,10 @@ export class Forum extends Actor { return []; } const post = this.getPost(postId); - this.actions.propagateValue.log(fromActor, post, `(increment: ${increment})`); + const adjustedIncrement = increment * (1 - params.leachingValue * post.totalCitationWeight); + const rewards = new Map(); const addReward = (id, value) => rewards.set(id, (rewards.get(id) ?? 0) + value); const addRewards = (r) => { @@ -103,12 +104,12 @@ export class Forum extends Actor { // Increment the value of the post // Apply leaching value const currentValue = this.getPostValue(postId); - const newValue = currentValue + increment * (1 - params.leachingValue * post.totalCitationWeight); + const newValue = currentValue + adjustedIncrement; await this.setPostValue(postId, newValue); // Award reputation to post author - console.log('reward for post author', post.authorPublicKey, increment); - addReward(post.authorPublicKey, increment); + console.log('reward for post author', post.authorPublicKey, adjustedIncrement); + addReward(post.authorPublicKey, adjustedIncrement); // Recursively distribute reputation to citations, according to weights for (const { postId: citedPostId, weight } of post.citations) {