Skip to content

Commit

Permalink
Merge pull request #193 from rubixchain/hari/distribured-pledging-fix
Browse files Browse the repository at this point in the history
fix: distributed pledging exit when quorum count is <7
  • Loading branch information
thewebchap authored Jul 18, 2024
2 parents d566e17 + e3cc03e commit b98e084
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions core/quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,25 @@ func (qm *QuorumManager) GetQuorum(t int, lastChar string) []string {
return nil
}
var quorumAddrList []string
quorumCount := 0
quorumAddrCount := 0
for _, q := range quorumList {
addr := string(q.PeerID + "." + q.DID)
quorumAddrList = append(quorumAddrList, addr)
quorumCount = quorumCount + 1
if quorumCount == 7 {
quorumAddrCount = quorumAddrCount + 1
if quorumAddrCount == 7 {
break
}
}
return quorumAddrList
case QuorumTypeTwo:
var quorumAddrList []string
quorumCount := 0
quorumAddrCount := 0
for _, q := range qm.ql {
peerID := qm.GetPeerID(q)
addr := string(peerID + "." + q)
quorumAddrList = append(quorumAddrList, addr)
quorumCount = quorumCount + 1
if quorumCount == 7 {
quorumAddrCount = quorumAddrCount + 1
if quorumAddrCount == 7 {
break
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/quorum_initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ func (c *Core) initiateConsensus(cr *ConensusRequest, sc *contract.Contract, dc
delete(c.pd, cr.ReqID)
c.qlock.Unlock()
}()
c.quorumCount = 0
c.noBalanceQuorumCount = 0
c.quorumCount = QuorumRequired - len(cr.QuorumList)
c.noBalanceQuorumCount = QuorumRequired - len(cr.QuorumList)
for _, a := range cr.QuorumList {
//This part of code is trying to connect to the quorums in quorum list, where various functions are called to pledge the tokens
//and checking of transaction by the quorum i.e. consensus for the transaction. Once the quorum is connected, it pledges and
Expand Down

0 comments on commit b98e084

Please sign in to comment.