rpc/client: get policy contract hash in Init()
Drop hardcoded value.
This commit is contained in:
parent
ab12eee346
commit
9a78f1da19
3 changed files with 46 additions and 5 deletions
|
@ -8,9 +8,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
)
|
||||
|
||||
// PolicyContractHash represents a hash of native Policy contract.
|
||||
var PolicyContractHash, _ = util.Uint160DecodeStringBE("e9ff4ca7cc252e1dfddb26315869cd79505906ce")
|
||||
|
||||
// GetMaxTransactionsPerBlock invokes `getMaxTransactionsPerBlock` method on a
|
||||
// native Policy contract.
|
||||
func (c *Client) GetMaxTransactionsPerBlock() (int64, error) {
|
||||
|
@ -28,7 +25,10 @@ func (c *Client) GetFeePerByte() (int64, error) {
|
|||
}
|
||||
|
||||
func (c *Client) invokeNativePolicyMethod(operation string) (int64, error) {
|
||||
result, err := c.InvokeFunction(PolicyContractHash, operation, []smartcontract.Parameter{}, nil)
|
||||
if !c.initDone {
|
||||
return 0, errNetworkNotInitialized
|
||||
}
|
||||
result, err := c.InvokeFunction(c.cache.nativeHashes["policy"], operation, []smartcontract.Parameter{}, nil)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -42,7 +42,10 @@ func (c *Client) invokeNativePolicyMethod(operation string) (int64, error) {
|
|||
|
||||
// IsBlocked invokes `isBlocked` method on native Policy contract.
|
||||
func (c *Client) IsBlocked(hash util.Uint160) (bool, error) {
|
||||
result, err := c.InvokeFunction(PolicyContractHash, "isBlocked", []smartcontract.Parameter{{
|
||||
if !c.initDone {
|
||||
return false, errNetworkNotInitialized
|
||||
}
|
||||
result, err := c.InvokeFunction(c.cache.nativeHashes["policy"], "isBlocked", []smartcontract.Parameter{{
|
||||
Type: smartcontract.Hash160Type,
|
||||
Value: hash,
|
||||
}}, nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue