rpc/client: handle tx creation error
Fix neo-go contract invokefunction -w wallets/neofs1.json -a NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 -r http://main_chain.neofs.devenv:30333 af5dc5f7e6a6efc64d679098f328027591a2e518 deposit 12b97a2206ae4b10c7e0194b7b655c32cc912057 int:50 bytes: -- 12b97a2206ae4b10c7e0194b7b655c32cc912057 Enter account NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 password > panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x934bbc] goroutine 1 [running]: github.com/nspcc-dev/neo-go/pkg/core/transaction.(*Transaction).GetSignedPart(0x0, 0x1028200, 0xc00013c000, 0xc0001a2680) github.com/nspcc-dev/neo-go/pkg/core/transaction/transaction.go:208 +0x13c github.com/nspcc-dev/neo-go/pkg/wallet.(*Account).SignTx(0xc0000ef880, 0x0, 0x40, 0x80) github.com/nspcc-dev/neo-go/pkg/wallet/account.go:105 +0x61 github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).SignAndPushInvocationTx(0xc0001a0180, 0xc00008e280, 0x40, 0x80, 0xc0000ef880, 0xc140c6, 0x0, 0xc000218b90, 0x1, 0x1, ...) github.com/nspcc-dev/neo-go/pkg/rpc/client/rpc.go:449 +0xfe github.com/nspcc-dev/neo-go/cli/smartcontract.invokeInternal(0xc0000acb00, 0x1, 0x0, 0x0) github.com/nspcc-dev/neo-go/cli/smartcontract/smart_contract.go:493 +0xa4d github.com/nspcc-dev/neo-go/cli/smartcontract.invokeFunction(0xc0000acb00, 0x10100, 0xc0000acb00) github.com/nspcc-dev/neo-go/cli/smartcontract/smart_contract.go:418 +0x30 github.com/urfave/cli.HandleAction(0xc76cc0, 0xf175d0, 0xc0000acb00, 0xc00007ef00, 0x0) github.com/urfave/cli@v1.20.0/app.go:490 +0xc8 github.com/urfave/cli.Command.Run(0xdbcc3c, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd9659, 0x2a, 0xde821b, ...) github.com/urfave/cli@v1.20.0/command.go:210 +0x9e8 github.com/urfave/cli.(*App).RunAsSubcommand(0xc00021e000, 0xc0000ac840, 0x0, 0x0) github.com/urfave/cli@v1.20.0/app.go:379 +0x88b github.com/urfave/cli.Command.startApp(0xdb803f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd7472, 0x28, 0x0, ...) github.com/urfave/cli@v1.20.0/command.go:298 +0x81a github.com/urfave/cli.Command.Run(0xdb803f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd7472, 0x28, 0x0, ...) github.com/urfave/cli@v1.20.0/command.go:98 +0x1219 github.com/urfave/cli.(*App).Run(0xc00009bd40, 0xc000030100, 0x10, 0x10, 0x0, 0x0) github.com/urfave/cli@v1.20.0/app.go:255 +0x741 main.main() command-line-arguments/main.go:18 +0x4b
This commit is contained in:
parent
aba9c9c0a8
commit
8d3e06498c
1 changed files with 3 additions and 0 deletions
|
@ -446,6 +446,9 @@ func (c *Client) SignAndPushInvocationTx(script []byte, acc *wallet.Account, sys
|
|||
var err error
|
||||
|
||||
tx, err := c.CreateTxFromScript(script, acc, sysfee, int64(netfee), cosigners...)
|
||||
if err != nil {
|
||||
return txHash, fmt.Errorf("failed to create tx: %w", err)
|
||||
}
|
||||
if err = acc.SignTx(tx); err != nil {
|
||||
return txHash, fmt.Errorf("failed to sign tx: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue