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
|
pass
|
||||||
|
|
||||||
@classmethod
|
@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()
|
payload = parse_nucypher_ini_config()
|
||||||
return cls(**payload)
|
payload.update(kwargs)
|
||||||
|
return cls(*args, **payload)
|
||||||
|
|
||||||
@only_me
|
@only_me
|
||||||
def stake(self,
|
def stake(self,
|
||||||
|
@ -1168,14 +1175,8 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
||||||
expiration: maya.MayaDT = None,
|
expiration: maya.MayaDT = None,
|
||||||
lock_periods: int = None,
|
lock_periods: int = None,
|
||||||
*args, **kwargs):
|
*args, **kwargs):
|
||||||
"""
|
|
||||||
High-level staking daemon loop
|
|
||||||
|
|
||||||
amount: int,
|
"""High-level staking daemon loop"""
|
||||||
lock_periods: int = None,
|
|
||||||
expiration: maya.MayaDT = None,
|
|
||||||
entire_balance: bool = False
|
|
||||||
"""
|
|
||||||
|
|
||||||
if lock_periods and expiration:
|
if lock_periods and expiration:
|
||||||
raise ValueError("Pass the number of lock periods or an expiration MayaDT; not both.")
|
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,
|
_staking_receipts = super().stake(expiration=expiration,
|
||||||
lock_periods=lock_periods,
|
lock_periods=lock_periods,
|
||||||
*args, **kwargs)
|
*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:
|
if confirm_now:
|
||||||
self.confirm_activity()
|
self.confirm_activity()
|
||||||
|
|
||||||
|
@ -1195,6 +1201,10 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
||||||
terminal_period = uptime_period + lock_periods
|
terminal_period = uptime_period + lock_periods
|
||||||
current_period = uptime_period
|
current_period = uptime_period
|
||||||
|
|
||||||
|
#
|
||||||
|
# Daemon
|
||||||
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
@ -1223,6 +1233,9 @@ class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
|
||||||
|
# Cleanup #
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue