Skip to content

Commit

Permalink
reorder the block finalization check
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Sep 17, 2024
1 parent 2098213 commit a47efeb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/bootstrap/run/qc.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ func GenerateQCParticipantData(allNodes, internalNodes []bootstrap.NodeInfo, dkg
return nil, fmt.Errorf("need at least as many staking public keys as private keys (pub=%d, priv=%d)", len(allNodes), len(internalNodes))
}

// length of DKG participants needs to match stakingNodes, since we run DKG for external and internal validators
if len(allNodes) != len(dkgData.PrivKeyShares) {
return nil, fmt.Errorf("need exactly the same number of staking public keys as DKG private participants")
}

qcData := &ParticipantData{}

participantLookup := make(map[flow.Identifier]flow.DKGParticipant)
Expand Down Expand Up @@ -209,6 +204,13 @@ func GenerateQCParticipantData(allNodes, internalNodes []bootstrap.NodeInfo, dkg
})
}

// the above check could find out the missing nodes for dkg data
// length of DKG participants needs to match stakingNodes, since we run DKG for external and internal validators
if len(allNodes) != len(dkgData.PrivKeyShares) {
return nil, fmt.Errorf("(%v nodes != %v dkg key shares) need exactly the same number of staking public keys as DKG private participants",
len(allNodes), len(dkgData.PrivKeyShares))
}

qcData.Lookup = participantLookup
qcData.GroupKey = dkgData.PubGroupKey

Expand Down

0 comments on commit a47efeb

Please sign in to comment.