wallet: check for t.GetSignedPart() result correctness
It can return nil easily and signing that is a big mistake.
This commit is contained in:
parent
c9b1d359d8
commit
f2033b5e54
1 changed files with 3 additions and 0 deletions
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue