Skip to content

Commit b9b5146

Browse files
committed
adm: reuse unwrap.Int64 for registration price getter
Signed-off-by: Roman Khimov <[email protected]>
1 parent 2d8d343 commit b9b5146

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

cmd/neofs-adm/internal/modules/fschain/initialize_register.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package fschain
22

33
import (
4-
"errors"
54
"fmt"
65
"math/big"
76

@@ -136,26 +135,12 @@ func (c *initializeContext) transferNEOFinished() (bool, error) {
136135
return bal.Int64() < native.NEOTotalSupply, nil
137136
}
138137

139-
var errGetPriceInvalid = errors.New("`getRegisterPrice`: invalid response")
140-
141138
func (c *initializeContext) getCandidateRegisterPrice() (int64, error) {
142139
switch c.Client.(type) {
143140
case *rpcclient.Client:
144141
reader := neo.NewReader(c.ReadOnlyInvoker)
145142
return reader.GetRegisterPrice()
146143
default:
147-
neoHash := neo.Hash
148-
res, err := invokeFunction(c.Client, neoHash, "getRegisterPrice", nil, nil)
149-
if err != nil {
150-
return 0, err
151-
}
152-
if len(res.Stack) == 0 {
153-
return 0, errGetPriceInvalid
154-
}
155-
bi, err := res.Stack[0].TryInteger()
156-
if err != nil || !bi.IsInt64() {
157-
return 0, errGetPriceInvalid
158-
}
159-
return bi.Int64(), nil
144+
return unwrap.Int64(invokeFunction(c.Client, neo.Hash, "getRegisterPrice", nil, nil))
160145
}
161146
}

0 commit comments

Comments
 (0)