Skip to content

Commit

Permalink
fix(engine): checking if validator already staked
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 31, 2024
1 parent bb4d647 commit 67b7cda
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 0 additions & 14 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ func (c *Client) GetPeerInfo(address string) (*pactus.PeerInfo, error) {
return nil, errors.New("peer does not exist")
}

func (c *Client) IsValidator(address string) (bool, error) {
validators, err := c.blockchainClient.GetValidatorAddresses(context.Background(),
&pactus.GetValidatorAddressesRequest{})
if err != nil {
return false, err
}
for _, a := range validators.Addresses {
if a == address {
return true, nil
}
}
return false, nil
}

func (c *Client) GetValidatorInfo(address string) (*pactus.GetValidatorResponse, error) {
validator, err := c.blockchainClient.GetValidator(context.Background(),
&pactus.GetValidatorRequest{Address: address})
Expand Down
2 changes: 1 addition & 1 deletion engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func setup(t *testing.T) (*BotEngine, *client.MockIClient, *rpstore.MockIStore,
mockClient := client.NewMockIClient(ctrl)

cm := client.NewClientMgr()
cm.AddClient("addr-1", mockClient)
cm.AddClient("local-node", mockClient)

// mocking mockWallet.
mockWallet := wallet.NewMockIWallet(ctrl)
Expand Down

0 comments on commit 67b7cda

Please sign in to comment.