From f2033b5e54d91a5a0bd5a9c0fac7c8f9e537401b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 7 May 2020 21:48:45 +0300 Subject: [PATCH] wallet: check for t.GetSignedPart() result correctness It can return nil easily and signing that is a big mistake. --- pkg/wallet/account.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/wallet/account.go b/pkg/wallet/account.go index 2236e7216..22a440877 100644 --- a/pkg/wallet/account.go +++ b/pkg/wallet/account.go @@ -132,6 +132,9 @@ func (a *Account) SignTx(t *transaction.Transaction) error { return errors.New("account is not unlocked") } data := t.GetSignedPart() + if data == nil { + return errors.New("failed to get transaction's signed part") + } sign := a.privateKey.Sign(data) t.Scripts = append(t.Scripts, transaction.Witness{