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 c9b1d359d8
commit f2033b5e54

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{