Research Article
A Novel Semifragile Consensus Algorithm Based on Credit Space for Consortium Blockchain
Algorithm 3
Punishment algorithm for malicious nodes.
Input: U (the set of malicious nodes) | Output: prisonArray (prison layer array) | (1) | prisonArray[] = {}; //Initialize the prsion layer | (2) | while (node in U) | (3) | if JudgeMalicious (node) //Determine whether the node is malicious | (4) | time = pow (e, x); //Calculate penalty time | (5) | insert (node, prisonArray, time); //Put the node in jail and record the punishment time | (6) | node++; //Pointer moved to the next malicious node | (7) | continue; | (8) | end if | (9) | if JudgeTimeOut (node) //Determines whether the node penalty time expires | (10) | if (maliciousCount ≤ 2) //Determines whether the node is a malicious node | (11) | remove (node, prisonArray); //Remove the node | (12) | node++; //Pointer moved to the next malicious node | (13) | continue; | (14) | else | (15) | stayPrison (node); //Leave the node in the prison layer | (16) | node++; //Pointer moved to the next malicious node | (17) | continue; | (18) | end if | (19) | end if | (20) | end while |
|