-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check that validator exists before allowing for staking #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Minor comments:
babylonclient/babyloncontroller.go
Outdated
btcPk, err := response.BtcValidator.BtcPk.ToBTCPK() | ||
|
||
if err != nil { | ||
return nil, fmt.Errorf("received malfored btc pk in babylon response: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("received malfored btc pk in babylon response: %w", err) | |
return nil, fmt.Errorf("received malformed btc pk in babylon response: %w", err) |
itest/e2e_test.go
Outdated
|
||
resp, err = tm.BabylonClient.QueryValidators(100, 0) | ||
require.NoError(t, err) | ||
// No validators yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// No validators yet | |
// Should be 1 validator |
pop, | ||
) | ||
|
||
resp, err = tm.BabylonClient.QueryValidators(100, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can also test QueryValidator
here as this is the scope of this PR
staker/stakerapp.go
Outdated
_, err := app.babylonClient.QueryValidator(validatorPk) | ||
|
||
if err != nil { | ||
return nil, fmt.Errorf("error querying validator to stake funds to: %w", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be clearer if we wrap this into a method like func (app *StakerApp) validatorExists(valPk *btcec.PublicKey) (bool, error)
Fixes #20