forked from TrueCloudLab/frostfs-node
[#1294] neofs-adm: Use Global scope where needed
Provide explicit argument to `sendCommitteeTx` signifying whether a tx should try to use group signer. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
7d670129c9
commit
82fda42316
9 changed files with 22 additions and 19 deletions
|
@ -250,8 +250,8 @@ func (c *initializeContext) nnsContractState() (*state.Contract, error) {
|
|||
return cs, nil
|
||||
}
|
||||
|
||||
func (c *initializeContext) getSigner() transaction.Signer {
|
||||
if c.groupKey != nil {
|
||||
func (c *initializeContext) getSigner(tryGroup bool) transaction.Signer {
|
||||
if tryGroup && c.groupKey != nil {
|
||||
return transaction.Signer{
|
||||
Scopes: transaction.CustomGroups,
|
||||
AllowedGroups: keys.PublicKeys{c.groupKey},
|
||||
|
@ -263,6 +263,10 @@ func (c *initializeContext) getSigner() transaction.Signer {
|
|||
Scopes: transaction.Global, // Scope is important, as we have nested call to container contract.
|
||||
}
|
||||
|
||||
if !tryGroup {
|
||||
return signer
|
||||
}
|
||||
|
||||
nnsCs, err := c.nnsContractState()
|
||||
if err != nil {
|
||||
return signer
|
||||
|
@ -325,9 +329,12 @@ loop:
|
|||
return retErr
|
||||
}
|
||||
|
||||
func (c *initializeContext) sendCommitteeTx(script []byte, sysFee int64) error {
|
||||
// sendCommitteeTx creates transaction from script and sends it to RPC.
|
||||
// If sysFee is -1, it is calculated automatically. If tryGroup is false,
|
||||
// global scope is used for the signer (useful when working with native contracts).
|
||||
func (c *initializeContext) sendCommitteeTx(script []byte, sysFee int64, tryGroup bool) error {
|
||||
tx, err := c.Client.CreateTxFromScript(script, c.CommitteeAcc, sysFee, 0, []client.SignerAccount{{
|
||||
Signer: c.getSigner(),
|
||||
Signer: c.getSigner(tryGroup),
|
||||
Account: c.CommitteeAcc,
|
||||
}})
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue