mirror of https://github.com/nucypher/nucypher.git
Allow non-federated keyring generation to use etherbase as a default via node backend
parent
19891682f1
commit
0ffac8c4d8
|
@ -76,9 +76,6 @@ def felix(click_config,
|
|||
click.prompt(f"New geth address is {new_checksum_address}. \n"
|
||||
f"Press ENTER key to continue", default=True)
|
||||
|
||||
elif not checksum_address:
|
||||
raise click.BadArgumentUsage('--checksum-address is required to initialize a new Felix configuration.')
|
||||
|
||||
new_felix_config = FelixConfiguration.generate(password=new_password,
|
||||
config_root=config_root,
|
||||
rest_host=host,
|
||||
|
|
|
@ -198,7 +198,7 @@ def ursula(click_config,
|
|||
if dev:
|
||||
|
||||
ETH_NODE = NuCypherGethDevProcess()
|
||||
ETH_NODE.start()()
|
||||
ETH_NODE.start()
|
||||
provider_uri = ETH_NODE.provider_uri
|
||||
|
||||
ursula_config = UrsulaConfiguration(dev_mode=True,
|
||||
|
@ -304,7 +304,6 @@ def ursula(click_config,
|
|||
URSULA = ursula_config(password=password, known_nodes=teacher_nodes, lonely=lonely)
|
||||
del password # ... under the rug
|
||||
|
||||
|
||||
#
|
||||
# Authenticated Action Switch
|
||||
#
|
||||
|
@ -336,7 +335,7 @@ def ursula(click_config,
|
|||
stdio.StandardIO(UrsulaCommandProtocol(ursula=URSULA))
|
||||
|
||||
if dry_run:
|
||||
return # <-- ABORT -X (Last Chance)
|
||||
return # <-- ABORT - (Last Chance)
|
||||
|
||||
# Run - Step 3
|
||||
node_deployer = URSULA.get_deployer()
|
||||
|
|
|
@ -123,6 +123,8 @@ def _write_private_keyfile(keypath: str,
|
|||
---------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
if os.path.isfile(keypath):
|
||||
raise RuntimeError(f"Private keyfile {keypath} already exists.")
|
||||
try:
|
||||
keyfile_descriptor = os.open(keypath, flags=__PRIVATE_FLAGS, mode=__PRIVATE_MODE)
|
||||
finally:
|
||||
|
@ -530,7 +532,7 @@ class NucypherKeyring:
|
|||
if curve is None:
|
||||
curve = cls.__DEFAULT_TLS_CURVE
|
||||
|
||||
if checksum_address is not None and not is_checksum_address(checksum_address):
|
||||
if checksum_address and not is_checksum_address(checksum_address):
|
||||
raise ValueError(f"{checksum_address} is not a valid ethereum checksum address")
|
||||
|
||||
_base_filepaths = cls._generate_base_filepaths(keyring_root=keyring_root)
|
||||
|
|
|
@ -617,21 +617,32 @@ class NodeConfiguration(ABC):
|
|||
*args, **kwargs)
|
||||
|
||||
def write_keyring(self, password: str, **generation_kwargs) -> NucypherKeyring:
|
||||
|
||||
# Get or create wallet address
|
||||
if not self.federated_only and not self.checksum_public_address:
|
||||
if self.geth:
|
||||
data_dir = os.path.join(self.config_root, '.ethereum', NuCypherGethDevnetProcess._CHAIN_NAME)
|
||||
etherbase = NuCypherGethDevnetProcess.ensure_account_exists(password=password, data_dir=data_dir)
|
||||
|
||||
try:
|
||||
checksum_address = self.blockchain.interface.w3.eth.accounts[0] # etherbase
|
||||
else:
|
||||
except IndexError:
|
||||
client_version = self.interface.w3.clientVersion
|
||||
if 'Geth' in client_version:
|
||||
data_dir = os.path.join(self.config_root, '.ethereum', NuCypherGethDevnetProcess._CHAIN_NAME)
|
||||
checksum_address = NuCypherGethDevnetProcess.ensure_account_exists(password=password, data_dir=data_dir)
|
||||
|
||||
# Use explicit address
|
||||
elif self.checksum_public_address:
|
||||
checksum_address = self.checksum_public_address
|
||||
|
||||
# Generate a federated checksum address
|
||||
elif self.federated_only and not self.checksum_public_address:
|
||||
checksum_address = None
|
||||
|
||||
else:
|
||||
raise RuntimeError("Something wonderful is happening") # FIXME: Flow control here is a mess
|
||||
|
||||
self.keyring = NucypherKeyring.generate(password=password,
|
||||
keyring_root=self.keyring_dir,
|
||||
checksum_address=checksum_address,
|
||||
**generation_kwargs)
|
||||
# Operating mode switch TODO: #466
|
||||
# Operating mode switch
|
||||
if self.federated_only:
|
||||
self.checksum_public_address = self.keyring.federated_address
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue