[#496] morph/client: fallback to simple invoke in NotaryInvoke

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-05-21 10:39:21 +03:00 committed by Alex Vanin
parent 2e31cd34e6
commit b5cda8cd41
7 changed files with 23 additions and 104 deletions

View file

@ -200,14 +200,14 @@ func (c *Client) UpdateNeoFSAlphabetList(list keys.PublicKeys) error {
}
// NotaryInvoke invokes contract method by sending tx to notary contract in
// blockchain. Fallback tx is a `RET`. Notary support should be enabled
// in client to use this function.
// blockchain. Fallback tx is a `RET`. If Notary support is not enabled
// it fallbacks to a simple `Invoke()`.
//
// This function must be invoked after `EnableNotarySupport()` otherwise it
// throws panic.
func (c *Client) NotaryInvoke(contract util.Uint160, method string, args ...interface{}) error {
func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error {
if c.notary == nil {
panic(notaryNotEnabledPanicMsg)
return c.Invoke(contract, fee, method, args...)
}
return c.notaryInvoke(false, contract, method, args...)

View file

@ -63,10 +63,14 @@ func (s StaticClient) TestInvoke(method string, args ...interface{}) ([]stackite
}
// NotaryInvoke calls NotaryInvoke method of Client with static internal
// script hash. Returns error if notary support was not enabled in underlying
// script hash. Panics if notary support was not enabled in underlying
// moprh client.
func (s StaticClient) NotaryInvoke(method string, args ...interface{}) error {
return s.client.NotaryInvoke(
if s.client.notary == nil {
panic(notaryNotEnabledPanicMsg)
}
return s.client.notaryInvoke(
false,
s.scScriptHash,
method,
args...,