Skip to content

Commit

Permalink
client: Remove signer check error
Browse files Browse the repository at this point in the history
These methods never return ErrMissingSigner because the signer was created in the constructor and available all time.

Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Jul 7, 2023
1 parent 1b6bf4e commit 6bfae0f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
6 changes: 0 additions & 6 deletions client/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (x *PrmBalanceGet) SetAccount(id user.ID) {
//
// Return errors:
// - [ErrMissingAccount]
// - [ErrMissingSigner]
func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) {
var err error
defer func() {
Expand All @@ -54,11 +53,6 @@ func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (accounting.
return accounting.Decimal{}, err
}

if c.prm.signer == nil {
err = ErrMissingSigner
return accounting.Decimal{}, err
}

// form request body
var accountV2 refs.OwnerID
prm.account.WriteToV2(&accountV2)
Expand Down
15 changes: 0 additions & 15 deletions client/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,12 @@ func (x ResEndpointInfo) NodeInfo() netmap.NodeInfo {
//
// Exactly one return value is non-nil. Server status return is returned in ResEndpointInfo.
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Returns errors:
// - [ErrMissingSigner]
func (c *Client) EndpointInfo(ctx context.Context, prm PrmEndpointInfo) (*ResEndpointInfo, error) {
var err error
defer func() {
c.sendStatistic(stat.MethodEndpointInfo, err)()
}()

if c.prm.signer == nil {
err = ErrMissingSigner
return nil, err
}

// form request
var req v2netmap.LocalNodeInfoRequest

Expand Down Expand Up @@ -199,19 +191,12 @@ type PrmNetMapSnapshot struct {
// Context is required and MUST NOT be nil. It is used for network communication.
//
// Reflects all internal errors in second return value (transport problems, response processing, etc.).
//
// Returns errors:
// - [ErrMissingSigner]
func (c *Client) NetMapSnapshot(ctx context.Context, _ PrmNetMapSnapshot) (netmap.NetMap, error) {
var err error
defer func() {
c.sendStatistic(stat.MethodNetMapSnapshot, err)()
}()

if c.prm.signer == nil {
err = ErrMissingSigner
return netmap.NetMap{}, err
}
// form request body
var body v2netmap.SnapshotRequestBody

Expand Down
12 changes: 0 additions & 12 deletions client/reputation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type PrmAnnounceLocalTrust struct {
// Return errors:
// - [ErrZeroEpoch]
// - [ErrMissingTrusts]
// - [ErrMissingSigner]
//
// Parameter epoch must not be zero.
// Parameter trusts must not be empty.
Expand All @@ -51,11 +50,6 @@ func (c *Client) AnnounceLocalTrust(ctx context.Context, epoch uint64, trusts []
return err
}

if c.prm.signer == nil {
err = ErrMissingSigner
return err
}

// form request body
reqBody := new(v2reputation.AnnounceLocalTrustRequestBody)
reqBody.SetEpoch(epoch)
Expand Down Expand Up @@ -118,7 +112,6 @@ func (x *PrmAnnounceIntermediateTrust) SetIteration(iter uint32) {
//
// Return errors:
// - [ErrZeroEpoch]
// - [ErrMissingSigner]
//
// Parameter epoch must not be zero.
func (c *Client) AnnounceIntermediateTrust(ctx context.Context, epoch uint64, trust reputation.PeerToPeerTrust, prm PrmAnnounceIntermediateTrust) error {
Expand All @@ -132,11 +125,6 @@ func (c *Client) AnnounceIntermediateTrust(ctx context.Context, epoch uint64, tr
return err
}

if c.prm.signer == nil {
err = ErrMissingSigner
return err
}

var v2Trust v2reputation.PeerToPeerTrust
trust.WriteToV2(&v2Trust)

Expand Down

0 comments on commit 6bfae0f

Please sign in to comment.