mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
cli: fix contract deploy&invoke
We should add cosigners to deplyment and invocation transactions.
This commit is contained in:
parent
02bc0bdc1e
commit
1880e96844
2 changed files with 4 additions and 3 deletions
|
@ -460,7 +460,7 @@ func invokeInternal(ctx *cli.Context, signAndPush bool) error {
|
|||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("bad script returned from the RPC node: %v", err), 1)
|
||||
}
|
||||
txHash, err := c.SignAndPushInvocationTx(script, acc, 0, gas)
|
||||
txHash, err := c.SignAndPushInvocationTx(script, acc, 0, gas, cosigners)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to push invocation tx: %v", err), 1)
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ func contractDeploy(ctx *cli.Context) error {
|
|||
return cli.NewExitError(fmt.Errorf("failed to test-invoke deployment script: %v", err), 1)
|
||||
}
|
||||
|
||||
txHash, err := c.SignAndPushInvocationTx(txScript, acc, invRes.GasConsumed, gas)
|
||||
txHash, err := c.SignAndPushInvocationTx(txScript, acc, invRes.GasConsumed, gas, nil)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to push invocation tx: %v", err), 1)
|
||||
}
|
||||
|
|
|
@ -429,12 +429,13 @@ func (c *Client) SubmitBlock(b block.Block) error {
|
|||
// SignAndPushInvocationTx signs and pushes given script as an invocation
|
||||
// transaction using given wif to sign it and spending the amount of gas
|
||||
// specified. It returns a hash of the invocation transaction and an error.
|
||||
func (c *Client) SignAndPushInvocationTx(script []byte, acc *wallet.Account, sysfee int64, netfee util.Fixed8) (util.Uint256, error) {
|
||||
func (c *Client) SignAndPushInvocationTx(script []byte, acc *wallet.Account, sysfee int64, netfee util.Fixed8, cosigners []transaction.Cosigner) (util.Uint256, error) {
|
||||
var txHash util.Uint256
|
||||
var err error
|
||||
|
||||
tx := transaction.New(c.opts.Network, script, sysfee)
|
||||
tx.SystemFee = sysfee
|
||||
tx.Cosigners = cosigners
|
||||
|
||||
validUntilBlock, err := c.CalculateValidUntilBlock()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue