forked from TrueCloudLab/frostfs-node
[#486] innerring: Use fee provider interface in invoke
package
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
1f3bb33db8
commit
91a1896b8b
7 changed files with 135 additions and 24 deletions
|
@ -14,7 +14,7 @@ type (
|
|||
Signature []byte
|
||||
}
|
||||
|
||||
// ContainerParams for container put invocation.
|
||||
// RemoveContainerParams for container delete invocation.
|
||||
RemoveContainerParams struct {
|
||||
ContainerID []byte
|
||||
Signature []byte
|
||||
|
@ -27,11 +27,19 @@ const (
|
|||
)
|
||||
|
||||
// RegisterContainer invokes Put method.
|
||||
func RegisterContainer(cli *client.Client, con util.Uint160, p *ContainerParams) error {
|
||||
func RegisterContainer(cli *client.Client, con util.Uint160, fee SideFeeProvider, p *ContainerParams) error {
|
||||
if cli == nil {
|
||||
return client.ErrNilClient
|
||||
}
|
||||
|
||||
if !cli.NotaryEnabled() {
|
||||
return cli.Invoke(con, fee.SideChainFee(), putContainerMethod,
|
||||
p.Container,
|
||||
p.Signature,
|
||||
p.Key.Bytes(),
|
||||
)
|
||||
}
|
||||
|
||||
return cli.NotaryInvoke(con, putContainerMethod,
|
||||
p.Container,
|
||||
p.Signature,
|
||||
|
@ -39,12 +47,19 @@ func RegisterContainer(cli *client.Client, con util.Uint160, p *ContainerParams)
|
|||
)
|
||||
}
|
||||
|
||||
// RegisterContainer invokes Delete method.
|
||||
func RemoveContainer(cli *client.Client, con util.Uint160, p *RemoveContainerParams) error {
|
||||
// RemoveContainer invokes Delete method.
|
||||
func RemoveContainer(cli *client.Client, con util.Uint160, fee SideFeeProvider, p *RemoveContainerParams) error {
|
||||
if cli == nil {
|
||||
return client.ErrNilClient
|
||||
}
|
||||
|
||||
if !cli.NotaryEnabled() {
|
||||
return cli.Invoke(con, fee.SideChainFee(), deleteContainerMethod,
|
||||
p.ContainerID,
|
||||
p.Signature,
|
||||
)
|
||||
}
|
||||
|
||||
return cli.NotaryInvoke(con, deleteContainerMethod,
|
||||
p.ContainerID,
|
||||
p.Signature,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue