-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dash): connect to all other quorum members
- Loading branch information
Showing
5 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package selectpeers | ||
|
||
import ( | ||
"github.com/dashpay/tenderdash/types" | ||
) | ||
|
||
type allValidatorsSelector struct { | ||
} | ||
|
||
var _ ValidatorSelector = (*allValidatorsSelector)(nil) | ||
|
||
// NewAllValidatorsSelector creates new implementation of validator selector algorithm | ||
// that selects all validators except local node | ||
func NewAllValidatorsSelector() ValidatorSelector { | ||
return &allValidatorsSelector{} | ||
} | ||
|
||
// SelectValidators implements ValidtorSelector. | ||
// SelectValidators selects all validators from `validatorSetMembers`, except local node | ||
func (s *allValidatorsSelector) SelectValidators( | ||
validatorSetMembers []*types.Validator, | ||
me *types.Validator, | ||
) ([]*types.Validator, error) { | ||
ret := make([]*types.Validator, 0, len(validatorSetMembers)-1) | ||
for _, val := range validatorSetMembers { | ||
if !val.ProTxHash.Equal(me.ProTxHash) { | ||
ret = append(ret, val) | ||
} | ||
} | ||
return ret, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters