diff --git a/forum-network/src/classes/dao/forum.js b/forum-network/src/classes/dao/forum.js index e311e1f..7826cca 100644 --- a/forum-network/src/classes/dao/forum.js +++ b/forum-network/src/classes/dao/forum.js @@ -184,6 +184,7 @@ export class Forum extends ReputationHolder { if (citationEdge.to.id === INCINERATOR_ADDRESS) { // Only a positive amount may be incinerated! Otherwise the sink could be used as a source. if (outboundAmount < 0) { + this.scene?.flowchart?.log(`style ${citationEdge.from.id} fill:#620000`); throw new Error('Incinerator can only receive positive citations!'); } // Reputation sent to the incinerator is burned! This means it is deducted from the sender, diff --git a/forum-network/src/tests/scripts/forum/forum8.test.js b/forum-network/src/tests/scripts/forum/forum8.test.js index 86a7fa6..513cc91 100644 --- a/forum-network/src/tests/scripts/forum/forum8.test.js +++ b/forum-network/src/tests/scripts/forum/forum8.test.js @@ -34,6 +34,16 @@ describe('Forum', function tests() { forum.getPost(posts[0]).value.should.equal(0); forum.getPost(posts[1]).value.should.equal(0); }); + + it('Reputation can not be sourced from the incinerator', async () => { + try { + await forumTest.addPost(experts[0], 10, [ + { postId: INCINERATOR_ADDRESS, weight: -1 }, + ]); + } catch (e) { + e.message.should.match(/Incinerator can only receive positive citations/); + } + }); }); });