From 6bfae0fff03f7f4e54a3322edee4f8b3f1f33df0 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Wed, 5 Jul 2023 17:03:57 +0400 Subject: [PATCH] client: Remove signer check error These methods never return ErrMissingSigner because the signer was created in the constructor and available all time. Signed-off-by: Evgenii Baidakov --- client/accounting.go | 6 ------ client/netmap.go | 15 --------------- client/reputation.go | 12 ------------ 3 files changed, 33 deletions(-) diff --git a/client/accounting.go b/client/accounting.go index 9165a1d4..da8b974b 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -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() { @@ -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) diff --git a/client/netmap.go b/client/netmap.go index c55f2b2a..8c822d30 100644 --- a/client/netmap.go +++ b/client/netmap.go @@ -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 @@ -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 diff --git a/client/reputation.go b/client/reputation.go index 99300b69..a0e70e3b 100644 --- a/client/reputation.go +++ b/client/reputation.go @@ -31,7 +31,6 @@ type PrmAnnounceLocalTrust struct { // Return errors: // - [ErrZeroEpoch] // - [ErrMissingTrusts] -// - [ErrMissingSigner] // // Parameter epoch must not be zero. // Parameter trusts must not be empty. @@ -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) @@ -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 { @@ -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)