forked from TrueCloudLab/frostfs-node
be353ad69f
Large inner ring requires more gas to make container registration. Container contract makes balance transfers for each inner ring node and it require extra gas to execute. This estimation should be enough for seven inner ring nodes. Later there should be heuristic evaluations for this: #47 Signed-off-by: Alex Vanin <alexey@nspcc.ru>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package invoke
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
|
)
|
|
|
|
type (
|
|
// ContainerParams for container put invocation.
|
|
ContainerParams struct {
|
|
Key *keys.PublicKey
|
|
Container []byte
|
|
Signature []byte
|
|
}
|
|
|
|
// ContainerParams for container put invocation.
|
|
RemoveContainerParams struct {
|
|
ContainerID []byte
|
|
Signature []byte
|
|
}
|
|
)
|
|
|
|
const (
|
|
putContainerMethod = "put"
|
|
deleteContainerMethod = "delete"
|
|
)
|
|
|
|
// RegisterContainer invokes Put method.
|
|
func RegisterContainer(cli *client.Client, con util.Uint160, p *ContainerParams) error {
|
|
if cli == nil {
|
|
return client.ErrNilClient
|
|
}
|
|
|
|
return cli.Invoke(con, 2*extraFee, putContainerMethod,
|
|
p.Container,
|
|
p.Signature,
|
|
p.Key.Bytes(),
|
|
)
|
|
}
|
|
|
|
// RegisterContainer invokes Delete method.
|
|
func RemoveContainer(cli *client.Client, con util.Uint160, p *RemoveContainerParams) error {
|
|
if cli == nil {
|
|
return client.ErrNilClient
|
|
}
|
|
|
|
return cli.Invoke(con, extraFee, deleteContainerMethod,
|
|
p.ContainerID,
|
|
p.Signature,
|
|
)
|
|
}
|