[#85] pool: use non-pointer client inside wrapper
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
9e8e12f6ae
commit
97c8274dc0
1 changed files with 10 additions and 4 deletions
14
pool/pool.go
14
pool/pool.go
|
@ -53,7 +53,7 @@ type client interface {
|
|||
|
||||
// clientWrapper is used by default, alternative implementations are intended for testing purposes only.
|
||||
type clientWrapper struct {
|
||||
client *sdkClient.Client
|
||||
client sdkClient.Client
|
||||
key ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
|
@ -86,14 +86,20 @@ func newWrapper(prm wrapperPrm) (*clientWrapper, error) {
|
|||
prmInit.SetDefaultPrivateKey(prm.key)
|
||||
prmInit.SetResponseInfoCallback(prm.responseInfoCallback)
|
||||
|
||||
var c sdkClient.Client
|
||||
c.Init(prmInit)
|
||||
res := &clientWrapper{key: prm.key}
|
||||
|
||||
res.client.Init(prmInit)
|
||||
|
||||
var prmDial sdkClient.PrmDial
|
||||
prmDial.SetServerURI(prm.address)
|
||||
prmDial.SetTimeout(prm.timeout)
|
||||
|
||||
return &clientWrapper{client: &c, key: prm.key}, c.Dial(prmDial)
|
||||
err := res.client.Dial(prmDial)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("client dial: %w", err)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (*accounting.Decimal, error) {
|
||||
|
|
Loading…
Reference in a new issue