wallet: set WIF and public key on account decrypt

They are set during account creation and open+decrypt is
expected to put account in the same state.
This commit is contained in:
Evgenii Stratonikov 2020-02-20 13:06:10 +03:00
parent d837eb3761
commit ad6fa2aea9

View file

@ -122,7 +122,14 @@ func (a *Account) Decrypt(passphrase string) error {
return errors.New("no encrypted wif in the account")
}
a.privateKey, err = keys.NEP2Decrypt(a.EncryptedWIF, passphrase)
return err
if err != nil {
return err
}
a.publicKey = a.privateKey.PublicKey().Bytes()
a.wif = a.privateKey.WIF()
return nil
}
// Encrypt encrypts the wallet's PrivateKey with the given passphrase