[#1702] neofs-adm: Set HighPriority attribute for committee transactions

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
remotes/fyrchik/fix-grpc-timeout-backup
Evgenii Stratonikov 2022-08-18 13:28:10 +03:00 committed by fyrchik
parent 0720d96c9d
commit e4370c4129
1 changed files with 16 additions and 2 deletions

View File

@ -363,14 +363,28 @@ loop:
// 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, []rpcclient.SignerAccount{{
cosigners := []rpcclient.SignerAccount{{
Signer: c.getSigner(tryGroup),
Account: c.CommitteeAcc,
}})
}}
tx, err := c.Client.CreateTxFromScript(script, c.CommitteeAcc, sysFee, 0, cosigners)
if err != nil {
return fmt.Errorf("can't create tx: %w", err)
}
tx.Attributes = append(tx.Attributes, transaction.Attribute{Type: transaction.HighPriority})
// Calculate network fee again, because tx size has changed.
_, accounts, err := getSigners(c.CommitteeAcc, cosigners)
if err != nil {
panic(fmt.Errorf("BUG: can't calculate network fee: %w", err))
}
tx.NetworkFee = 0
err = c.Client.AddNetworkFee(tx, 0, accounts...)
if err != nil {
return fmt.Errorf("failed to add network fee: %w", err)
}
return c.multiSignAndSend(tx, committeeAccountName)
}