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) {