Skip to content

Commit

Permalink
Moved setting unmarshaller just after the channel creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed Aug 24, 2023
1 parent 8800eac commit 244a769
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/tbtc/dkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (de *dkgExecutor) preParamsCount() int {
// the result to the chain. The execution can be delayed by an arbitrary number
// of blocks using the delayBlocks argument. This allows confirming the state
// on-chain - e.g. wait for the required number of confirming blocks - before
//executing the off-chain action.
// executing the off-chain action.
func (de *dkgExecutor) executeDkgIfEligible(
seed *big.Int,
startBlock uint64,
Expand Down Expand Up @@ -162,12 +162,12 @@ func (de *dkgExecutor) executeDkgIfEligible(

// checkEligibility performs on-chain group selection and returns two pieces
// of information:
// - Indexes of members selected to the signing group and controlled by this
// operator. The indexes are in range [1, `groupSize`]. The slice is nil if
// none of the selected signing group members is controlled by this operator.
// - Group selection result holding chain.OperatorID and chain.Address for
// operators selected to the signing group. There are always `groupSize`
// selected operators.
// - Indexes of members selected to the signing group and controlled by this
// operator. The indexes are in range [1, `groupSize`]. The slice is nil if
// none of the selected signing group members is controlled by this operator.
// - Group selection result holding chain.OperatorID and chain.Address for
// operators selected to the signing group. There are always `groupSize`
// selected operators.
func (de *dkgExecutor) checkEligibility(
dkgLogger log.StandardLogger,
) ([]uint8, *GroupSelectionResult, error) {
Expand Down Expand Up @@ -218,6 +218,7 @@ func (de *dkgExecutor) setupBroadcastChannel(
}

dkg.RegisterUnmarshallers(broadcastChannel)
announcer.RegisterUnmarshaller(broadcastChannel)

err = broadcastChannel.SetFilter(membershipValidator.IsInGroup)
if err != nil {
Expand Down Expand Up @@ -259,8 +260,6 @@ func (de *dkgExecutor) generateSigningGroup(
return
}

announcer.RegisterUnmarshaller(broadcastChannel)

dkgParameters, err := de.chain.DKGParameters()
if err != nil {
dkgLogger.Errorf("cannot get DKG parameters: [%v]", err)
Expand Down

0 comments on commit 244a769

Please sign in to comment.