change daily_fee to be lbc instead of dewies

This commit is contained in:
Victor Shyba 2020-01-06 01:53:51 -03:00
parent c2d717aba5
commit d317a4042c
2 changed files with 11 additions and 3 deletions

View file

@ -81,7 +81,7 @@ class Env:
self.session_timeout = self.integer('SESSION_TIMEOUT', 600) self.session_timeout = self.integer('SESSION_TIMEOUT', 600)
self.drop_client = self.custom("DROP_CLIENT", None, re.compile) self.drop_client = self.custom("DROP_CLIENT", None, re.compile)
self.description = self.default('DESCRIPTION', '') self.description = self.default('DESCRIPTION', '')
self.daily_fee = self.integer('DAILY_FEE', 0) self.daily_fee = self.string_amount('DAILY_FEE', '0')
# Identities # Identities
clearnet_identity = self.clearnet_identity() clearnet_identity = self.clearnet_identity()
@ -107,6 +107,14 @@ class Env:
raise cls.Error(f'required envvar {envvar} not set') raise cls.Error(f'required envvar {envvar} not set')
return value return value
@classmethod
def string_amount(cls, envvar, default):
value = environ.get(envvar, default)
amount_pattern = re.compile("[0-9]{0,10}(\.[0-9]{1,8})?")
if len(value) > 0 and not amount_pattern.fullmatch(value):
raise cls.Error(f'{value} is not a valid amount for {envvar}')
return value
@classmethod @classmethod
def integer(cls, envvar, default): def integer(cls, envvar, default):
value = environ.get(envvar) value = environ.get(envvar)

View file

@ -29,7 +29,7 @@ class NetworkTests(IntegrationTestCase):
'pruning': None, 'pruning': None,
'description': '', 'description': '',
'payment_address': '', 'payment_address': '',
'daily_fee': 0, 'daily_fee': '0',
'server_version': lbry.__version__}, await self.ledger.network.get_server_features()) 'server_version': lbry.__version__}, await self.ledger.network.get_server_features())
await self.conductor.spv_node.stop() await self.conductor.spv_node.stop()
address = (await self.account.get_addresses(limit=1))[0] address = (await self.account.get_addresses(limit=1))[0]
@ -48,7 +48,7 @@ class NetworkTests(IntegrationTestCase):
'pruning': None, 'pruning': None,
'description': 'Fastest server in the west.', 'description': 'Fastest server in the west.',
'payment_address': address, 'payment_address': address,
'daily_fee': 42, 'daily_fee': '42',
'server_version': lbry.__version__}, await self.ledger.network.get_server_features()) 'server_version': lbry.__version__}, await self.ledger.network.get_server_features())