Allow the init of a character without a checksum address until Moe inherets from Learner directly.

remotes/upstream/doubtfire
Kieran Prasch 2019-09-05 17:37:05 -07:00 committed by Kieran R. Prasch
parent 39fd967222
commit ad4dce6dd3
3 changed files with 16 additions and 13 deletions

View File

@ -209,10 +209,11 @@ class Character(Learner):
# Decentralized # Decentralized
# #
if not federated_only: if not federated_only:
if not checksum_address: # TODO: WHY MOE?
raise ValueError("No checksum_address provided to run in decentralized mode.") # if not checksum_address:
else: # raise ValueError("No checksum_address provided to run in decentralized mode.")
self._checksum_address = checksum_address # TODO: Check that this matches TransactingPower # else:
self._checksum_address = checksum_address # TODO: Check that this matches TransactingPower
# #
# Federated # Federated
# #
@ -230,13 +231,14 @@ class Character(Learner):
# #
# Nicknames # Nicknames
# #
try: if checksum_address: # TODO WHY MOE??
self.nickname, self.nickname_metadata = nickname_from_seed(self.checksum_address) try:
except SigningPower.not_found_error: self.nickname, self.nickname_metadata = nickname_from_seed(self.checksum_address)
if self.federated_only: except SigningPower.not_found_error:
self.nickname = self.nickname_metadata = NO_NICKNAME if self.federated_only:
else: self.nickname = self.nickname_metadata = NO_NICKNAME
raise else:
raise
# #
# Fleet state # Fleet state

View File

@ -33,13 +33,14 @@ from nucypher.characters.base import Character
from nucypher.config.constants import TEMPLATES_DIR from nucypher.config.constants import TEMPLATES_DIR
from nucypher.crypto.powers import SigningPower, TransactingPower from nucypher.crypto.powers import SigningPower, TransactingPower
from nucypher.keystore.threading import ThreadedSession from nucypher.keystore.threading import ThreadedSession
from nucypher.network.nodes import FleetStateTracker from nucypher.network.nodes import FleetStateTracker, Learner
from nucypher.network.status.status_page import MoeStatusPage from nucypher.network.status.status_page import MoeStatusPage
class Moe(Character): class Moe(Character):
""" """
A monitor (lizard?) A monitor (lizard?)
# TODO: Inherit directly from Learner
""" """
banner = MOE_BANNER banner = MOE_BANNER

View File

@ -178,7 +178,7 @@ class MoeStatusPage(NetworkStatusPage):
""" """
def __init__(self, moe: Learner, ws_port: int, *args, **kwargs): def __init__(self, moe: Learner, ws_port: int, *args, **kwargs):
super().__init__(self, *args, **kwargs) super().__init__(*args, **kwargs)
# modify index_string page template so that the websocket port for hendrix # modify index_string page template so that the websocket port for hendrix
# updates can be directly provided included in javascript snippet # updates can be directly provided included in javascript snippet