diff --git a/monero/seed.py b/monero/seed.py index 21f31e9..07dd924 100644 --- a/monero/seed.py +++ b/monero/seed.py @@ -61,6 +61,9 @@ class Seed(object): self.word_list = wordlists.get_wordlist(wordlist) + self._ed_pub_spend_key = None + self._ed_pub_view_key = None + if phrase_or_hex: seed_split = phrase_or_hex.split(" ") if len(seed_split) >= 24: @@ -137,10 +140,16 @@ class Seed(object): return self.sc_reduce(h.digest()) def public_spend_key(self): - return ed25519.public_from_secret_hex(self.secret_spend_key()) + if self._ed_pub_spend_key: + return self._ed_pub_spend_key + self._ed_pub_spend_key = ed25519.public_from_secret_hex(self.secret_spend_key()) + return self._ed_pub_spend_key def public_view_key(self): - return ed25519.public_from_secret_hex(self.secret_view_key()) + if self._ed_pub_view_key: + return self._ed_pub_view_key + self._ed_pub_view_key = ed25519.public_from_secret_hex(self.secret_view_key()) + return self._ed_pub_view_key def public_address(self, net='mainnet'): """Returns the master :class:`Address ` represented by the seed.