wallet: check for t.GetSignedPart() result correctness

It can return nil easily and signing that is a big mistake.
This commit is contained in:
Roman Khimov 2020-05-07 21:48:45 +03:00
parent 943d435cd2
commit 3db14b4699

View file

@ -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{