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 it is available by default. Creates in the constructor

Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Jul 5, 2023
1 parent 0f89c9c commit d4dec97
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
5 changes: 0 additions & 5 deletions client/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ func (x *PrmBalanceGet) SetAccount(id user.ID) {
//
// Return errors:
// - [ErrMissingAccount]
// - [ErrMissingSigner]
func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) {
switch {
case !prm.accountSet:
return accounting.Decimal{}, ErrMissingAccount
}

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

// form request body
var accountV2 refs.OwnerID
prm.account.WriteToV2(&accountV2)
Expand Down
13 changes: 0 additions & 13 deletions client/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ 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) {
if c.prm.signer == nil {
return nil, ErrMissingSigner
}

// form request
var req v2netmap.LocalNodeInfoRequest

Expand Down Expand Up @@ -179,13 +172,7 @@ 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) {
if c.prm.signer == nil {
return netmap.NetMap{}, ErrMissingSigner
}
// form request body
var body v2netmap.SnapshotRequestBody

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

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

// form request body
reqBody := new(v2reputation.AnnounceLocalTrustRequestBody)
reqBody.SetEpoch(epoch)
Expand Down Expand Up @@ -102,18 +97,13 @@ 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 {
if epoch == 0 {
return ErrZeroEpoch
}

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

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

Expand Down

0 comments on commit d4dec97

Please sign in to comment.