[#1959] neofs-adm: Fix set-config for >4 nodes

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-10-24 15:07:39 +03:00 committed by fyrchik
parent c87c3d3721
commit 6c21e2cc28
4 changed files with 17 additions and 4 deletions

View file

@ -132,7 +132,7 @@ func setConfigCmd(cmd *cobra.Command, args []string) error {
} }
} }
err = wCtx.sendCommitteeTx(bw.Bytes(), true) err = wCtx.sendConsensusTx(bw.Bytes())
if err != nil { if err != nil {
return err return err
} }

View file

@ -34,7 +34,7 @@ func forceNewEpochCmd(cmd *cobra.Command, args []string) error {
return err return err
} }
if err := wCtx.sendMultiTx(bw.Bytes(), true, true); err != nil { if err := wCtx.sendConsensusTx(bw.Bytes()); err != nil {
return err return err
} }

View file

@ -381,13 +381,20 @@ loop:
return retErr return retErr
} }
// sendCommitteeTx creates transaction from script and sends it to RPC. // sendCommitteeTx creates transaction from script, signs it by committee nodes and sends it to RPC.
// If tryGroup is false, global scope is used for the signer (useful when // If tryGroup is false, global scope is used for the signer (useful when
// working with native contracts). // working with native contracts).
func (c *initializeContext) sendCommitteeTx(script []byte, tryGroup bool) error { func (c *initializeContext) sendCommitteeTx(script []byte, tryGroup bool) error {
return c.sendMultiTx(script, tryGroup, false) return c.sendMultiTx(script, tryGroup, false)
} }
// sendConsensusTx creates transaction from script, signs it by alphabet nodes and sends it to RPC.
// Not that because this is used only after the contracts were initialized and deployed,
// we always try to have a group scope.
func (c *initializeContext) sendConsensusTx(script []byte) error {
return c.sendMultiTx(script, true, true)
}
func (c *initializeContext) sendMultiTx(script []byte, tryGroup bool, withConsensus bool) error { func (c *initializeContext) sendMultiTx(script []byte, tryGroup bool, withConsensus bool) error {
var act *actor.Actor var act *actor.Actor
var err error var err error

View file

@ -82,5 +82,11 @@ func testInitialize(t *testing.T, committeeSize int) {
v.Set(epochDurationInitFlag, 1) v.Set(epochDurationInitFlag, 1)
v.Set(maxObjectSizeInitFlag, 1024) v.Set(maxObjectSizeInitFlag, 1024)
require.NoError(t, initializeSideChainCmd(initCmd, nil)) require.NoError(t, initializeSideChainCmd(initCmd, nil))
require.NoError(t, forceNewEpochCmd(forceNewEpoch, nil))
t.Run("force-new-epoch", func(t *testing.T) {
require.NoError(t, forceNewEpochCmd(forceNewEpoch, nil))
})
t.Run("set-config", func(t *testing.T) {
require.NoError(t, setConfigCmd(setConfig, []string{"MaintenanceModeAllowed=true"}))
})
} }