[#421] morph/client: Add notary list update function

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-03-10 12:24:26 +03:00 committed by Alex Vanin
parent 0cd7fa415f
commit b3632dcd81

View file

@ -3,6 +3,7 @@ package client
import (
"crypto/elliptic"
"github.com/nspcc-dev/neo-go/pkg/core/native"
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
@ -45,6 +46,7 @@ const (
innerRingListMethod = "innerRingList"
notaryBalanceOfMethod = "balanceOf"
setDesignateMethod = "designateAsRole"
notaryBalanceErrMsg = "can't fetch notary balance"
)
@ -151,6 +153,20 @@ func (c *Client) GetNotaryDeposit() (int64, error) {
return bigIntDeposit.Int64(), nil
}
// UpdateNotaryList updates list of notary nodes in designate contract. Requires
// committee multi signature.
func (c *Client) UpdateNotaryList(list keys.PublicKeys) error {
if c.notary == nil {
return errNotaryNotEnabled
}
return c.notaryInvokeAsCommittee(c.designate,
setDesignateMethod,
native.RoleP2PNotary,
list,
)
}
// Invoke 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.