mirror of https://github.com/nucypher/nucypher.git
Fixes Ursula.from_config with overridable passthrough
parent
66e6517414
commit
042df33569
|
@ -1155,9 +1155,16 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
|||
pass
|
||||
|
||||
@classmethod
|
||||
def from_config(cls) -> 'Ursula':
|
||||
def from_config(cls, *args, **kwargs) -> 'Ursula':
|
||||
"""
|
||||
Initialize Ursula from .ini configuration file.
|
||||
|
||||
Keyword arguments passed will take precedence over values
|
||||
in the configuration file.
|
||||
"""
|
||||
payload = parse_nucypher_ini_config()
|
||||
return cls(**payload)
|
||||
payload.update(kwargs)
|
||||
return cls(*args, **payload)
|
||||
|
||||
@only_me
|
||||
def stake(self,
|
||||
|
@ -1168,14 +1175,8 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
|||
expiration: maya.MayaDT = None,
|
||||
lock_periods: int = None,
|
||||
*args, **kwargs):
|
||||
"""
|
||||
High-level staking daemon loop
|
||||
|
||||
amount: int,
|
||||
lock_periods: int = None,
|
||||
expiration: maya.MayaDT = None,
|
||||
entire_balance: bool = False
|
||||
"""
|
||||
"""High-level staking daemon loop"""
|
||||
|
||||
if lock_periods and expiration:
|
||||
raise ValueError("Pass the number of lock periods or an expiration MayaDT; not both.")
|
||||
|
@ -1186,6 +1187,11 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
|||
_staking_receipts = super().stake(expiration=expiration,
|
||||
lock_periods=lock_periods,
|
||||
*args, **kwargs)
|
||||
|
||||
# TODO: Check if this period has already been confirmed
|
||||
# TODO: Check if there is an active stake in the current period: Resume staking daemon
|
||||
# TODO: Validation and Sanity checks
|
||||
|
||||
if confirm_now:
|
||||
self.confirm_activity()
|
||||
|
||||
|
@ -1195,6 +1201,10 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
|||
terminal_period = uptime_period + lock_periods
|
||||
current_period = uptime_period
|
||||
|
||||
#
|
||||
# Daemon
|
||||
#
|
||||
|
||||
try:
|
||||
while True:
|
||||
|
||||
|
@ -1223,6 +1233,9 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
|||
continue
|
||||
|
||||
finally:
|
||||
|
||||
# Cleanup #
|
||||
|
||||
pass
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue