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
943d435cd2
commit
3db14b4699
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")
|
return errors.New("account is not unlocked")
|
||||||
}
|
}
|
||||||
data := t.GetSignedPart()
|
data := t.GetSignedPart()
|
||||||
|
if data == nil {
|
||||||
|
return errors.New("failed to get transaction's signed part")
|
||||||
|
}
|
||||||
sign := a.privateKey.Sign(data)
|
sign := a.privateKey.Sign(data)
|
||||||
|
|
||||||
t.Scripts = append(t.Scripts, transaction.Witness{
|
t.Scripts = append(t.Scripts, transaction.Witness{
|
||||||
|
|
Loading…
Add table
Reference in a new issue