From 7a930a8e1176767bb5e2591e0fc0d997a082e89f Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 24 Aug 2022 15:36:52 +0300 Subject: [PATCH] wallet: don't fail in SignTx when no contract provided Unfortunately valid NEP-6 can have no contract inside of account, so this should be accounted for. --- pkg/wallet/account.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/wallet/account.go b/pkg/wallet/account.go index 7b1619707..fff9dde7b 100644 --- a/pkg/wallet/account.go +++ b/pkg/wallet/account.go @@ -84,6 +84,9 @@ func NewAccount() (*Account, error) { // SignTx signs transaction t and updates it's Witnesses. func (a *Account) SignTx(net netmode.Magic, t *transaction.Transaction) error { + if a.Contract == nil { + return errors.New("account has no contract") + } if len(a.Contract.Parameters) == 0 { if len(t.Signers) != len(t.Scripts) { // Sequential signing vs. existing scripts. t.Scripts = append(t.Scripts, transaction.Witness{})