From 3db14b4699fcc6e8677bfc22743a20a5424c2113 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 273584259..c2892db7f 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{