Skip to content

Commit

Permalink
fix load reshare params for new committee
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush-rockx committed Mar 1, 2023
1 parent 0321b07 commit 75bdf2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions dkg/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ func (reshareMsg *ReshareParams) LoadFromStorage(pk types.ValidatorPK, storage S
return nil
}

func inOldCommittee(op types.OperatorID, l []types.OperatorID) bool {
for _, opID := range l {
if opID == op {
return true
}
}
return false
}

// Output is the last message in every DKG which marks a specific node's end of process
type Output struct {
// RequestID for the DKG instance (not used for signing)
Expand Down
6 changes: 4 additions & 2 deletions dkg/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ func (n *Node) newRunner(id RequestID, initMsg *Init) (Runner, error) {

func (n *Node) newResharingRunner(id RequestID, reshareMsg *Reshare) (Runner, error) {
reshareParams := &ReshareParams{}
if err := reshareParams.LoadFromStorage(reshareMsg.ValidatorPK, n.config.Storage); err != nil {
return nil, err
if inOldCommittee(n.operator.OperatorID, reshareMsg.OldOperatorIDs) {
if err := reshareParams.LoadFromStorage(reshareMsg.ValidatorPK, n.config.Storage); err != nil {
return nil, err
}
}

r := &runner{
Expand Down

0 comments on commit 75bdf2a

Please sign in to comment.