Skip to content

Commit

Permalink
[#984] neofs-adm: replace addRoot with register for NNS
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
  • Loading branch information
fyrchik authored and cthulhu-rider committed Nov 29, 2021
1 parent 63a8b53 commit 7765ab3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/neofs-adm/internal/modules/morph/initialize_nns.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ const defaultNameServiceSysfee = 4000_0000
const defaultRegisterSysfee = 10_0000_0000 + defaultNameServiceDomainPrice

func (c *initializeContext) setNNS() error {
nnsCs := c.getContract(nnsContract)
nnsCs, err := c.Client.GetContractStateByID(1)
if err != nil {
return err
}

ok, err := c.nnsRootRegistered(nnsCs.Hash)
if err != nil {
return err
} else if !ok {
bw := io.NewBufBinWriter()
emit.AppCall(bw.BinWriter, nnsCs.Hash, "addRoot", callflag.All, "neofs")
emit.AppCall(bw.BinWriter, nnsCs.Hash, "register", callflag.All,
"neofs", c.CommitteeAcc.Contract.ScriptHash(),
"ops@nspcc.ru", int64(3600), int64(600), int64(604800), int64(3600))
emit.Opcodes(bw.BinWriter, opcode.ASSERT)
if err := c.sendCommitteeTx(bw.Bytes(), -1); err != nil {
return fmt.Errorf("can't add domain root to NNS: %w", err)
}
Expand Down

0 comments on commit 7765ab3

Please sign in to comment.