rubixchain / rubixgoplatform

GNU General Public License v3.0
8 stars 17 forks source link

fix: distributed pledging exit when quorum count is <7 #193

Closed harirubix closed 1 month ago

harirubix commented 1 month ago

A fix for #173 when noBalanceQuorumCount check is done with quorum count 5 or 6.

Explanation

noBalanceQuorumCount is initialised to zero and incremented each time a quorum doesn't have enough tokens to pledge. Rubix PBFT consensus requires 5 nodes to pledge and hence as soon as noBalanceQuorumCount reaches greater than 2 , sender exit. The problem is when there are only 5 or 6 quorum nodes where in such situtaions , we should exit as soon as we realise we will not have 5 nodes that can pledge. Currently the sender wait 300 seconds before exiting with a different error code.

Fix

Initialise noBalanceQuorumCount to QuorumRequired - len(cr.QuorumList)

cr.QuorumList noBalanceQuorumCount
7 0
6 1
5 2

PS : Also renaming quorumCount in quorum.go to quorumAddrCount to avoid naming confusion.