Skip to content
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

Deduplicate client ready checks, fix a few places they were missing #378

Merged
merged 5 commits into from
Jul 20, 2023

Conversation

jshufro
Copy link
Contributor

@jshufro jshufro commented Jul 18, 2023

No description provided.

@@ -18,7 +18,7 @@ const (
func generateRewardsTree(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was missing the ready check

@@ -14,7 +14,7 @@ import (
func initializeFeeDistributor(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was missing here as well

@@ -73,7 +73,7 @@ func initializeFeeDistributor(c *cli.Context) error {
func distribute(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was missing here as well

@@ -14,7 +14,7 @@ import (
func sendMessage(c *cli.Context, toAddressOrENS string, message []byte) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was missing here as well

@@ -24,7 +24,7 @@ type PersonalSignature struct {
func signMessage(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't need synced clients :)

@@ -13,7 +13,7 @@ import (
func initWallet(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't care about client status

@@ -12,7 +12,7 @@ import (
func purge(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't care about client status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in recover/test-recovery, we only care about client status when -k isn't passed, so we record the result in ready and check it

@@ -12,7 +12,7 @@ import (
func getStatus(c *cli.Context) error {

// Get RP client
rp, err := rocketpool.NewClientFromCtx(c)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't care about client status

// When printing sync percents, we should avoid printing 100%.
// This function is only called if we're still syncing,
// and the `%0.2f` token will round up if we're above 99.99%.
func SyncRatioToPercent(in float64) float64 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might make sense to move this to a different util file, but for now i shoved it here

@jclapis
Copy link
Member

jclapis commented Jul 20, 2023

Good addition, this is definitely a better way to do it. Thanks Patches!

@jclapis jclapis merged commit cedb870 into rocket-pool:master Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants