forked from LBRYCommunity/lbry-sdk
max_key_fee in yaml as null
This commit is contained in:
parent
be0bd3bdea
commit
8a3b8d2df1
4 changed files with 13 additions and 9 deletions
|
@ -159,10 +159,11 @@ class Path(String):
|
|||
class MaxKeyFee(Setting[dict]):
|
||||
|
||||
def validate(self, value):
|
||||
assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \
|
||||
f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"."
|
||||
if value["currency"] not in CURRENCIES:
|
||||
raise InvalidCurrencyError(value["currency"])
|
||||
if value is not None:
|
||||
assert isinstance(value, dict) and set(value) == {'currency', 'amount'}, \
|
||||
f"Setting '{self.name}' must be a dict like \"{{'amount': 50.0, 'currency': 'USD'}}\"."
|
||||
if value["currency"] not in CURRENCIES:
|
||||
raise InvalidCurrencyError(value["currency"])
|
||||
|
||||
@staticmethod
|
||||
def _parse_list(l):
|
||||
|
|
|
@ -176,7 +176,7 @@ def get_argument_parser():
|
|||
help='Show lbrynet CLI version and exit.'
|
||||
)
|
||||
main.set_defaults(group=None, command=None)
|
||||
CLIConfig.contribute_args(main)
|
||||
CLIConfig.contribute_to_argparse(main)
|
||||
sub = main.add_subparsers(metavar='COMMAND')
|
||||
start = sub.add_parser(
|
||||
'start',
|
||||
|
@ -193,7 +193,7 @@ def get_argument_parser():
|
|||
'should selectively be applied.')
|
||||
)
|
||||
start.set_defaults(command='start', start_parser=start)
|
||||
Config.contribute_args(start)
|
||||
Config.contribute_to_argparse(start)
|
||||
|
||||
api = Daemon.get_api_definitions()
|
||||
groups = {}
|
||||
|
|
|
@ -766,7 +766,6 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
[--download_timeout=<download_timeout>]
|
||||
[--peer_port=<peer_port>]
|
||||
[--max_key_fee=<max_key_fee>]
|
||||
[--disable_max_key_fee=<disable_max_key_fee>]
|
||||
[--use_upnp=<use_upnp>]
|
||||
[--run_reflector_server=<run_reflector_server>]
|
||||
[--cache_time=<cache_time>]
|
||||
|
@ -787,9 +786,9 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
'currency': <currency_symbol>,
|
||||
'amount': <amount>
|
||||
}.
|
||||
In the CLI, it must be an escaped JSON string
|
||||
In the CLI, it must be: '<amount> <currency>'
|
||||
Supported currency symbols: LBC, USD, BTC
|
||||
--disable_max_key_fee=<disable_max_key_fee> : (bool) False
|
||||
--no_max_key_fee : (bool) Disable max key fee.
|
||||
--use_upnp=<use_upnp> : (bool) True
|
||||
--run_reflector_server=<run_reflector_server> : (bool) False
|
||||
--cache_time=<cache_time> : (int) 150
|
||||
|
|
|
@ -196,6 +196,10 @@ class ConfigurationTests(unittest.TestCase):
|
|||
c.max_key_fee = {'currency': 'BTC', 'amount': 1}
|
||||
with open(config, 'r') as fd:
|
||||
self.assertEqual(fd.read(), 'max_key_fee:\n amount: 1\n currency: BTC\n')
|
||||
with c.update_config():
|
||||
c.max_key_fee = None
|
||||
with open(config, 'r') as fd:
|
||||
self.assertEqual(fd.read(), 'max_key_fee: null\n')
|
||||
|
||||
def test_max_key_fee_from_args(self):
|
||||
parser = argparse.ArgumentParser()
|
||||
|
|
Loading…
Reference in a new issue