From ad6fa2aea9437fb3b63f57a9ebcfa3e1df73e374 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 20 Feb 2020 13:06:10 +0300 Subject: [PATCH] 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. --- pkg/wallet/account.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/wallet/account.go b/pkg/wallet/account.go index 25f9eae02..9b87c2e8f 100644 --- a/pkg/wallet/account.go +++ b/pkg/wallet/account.go @@ -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