forked from LBRYCommunity/lbry-sdk
max wallet server payment fee defaults to 0 and component doesnt start in that case
This commit is contained in:
parent
a70980c81a
commit
f41cfbfb97
3 changed files with 10 additions and 1 deletions
|
@ -558,7 +558,7 @@ class Config(CLIConfig):
|
|||
"Don't download streams with fees exceeding this amount. When set to "
|
||||
"null, the amount is unbounded.", {'currency': 'USD', 'amount': 50.0}
|
||||
)
|
||||
max_wallet_server_fee = String("Maximum daily LBC amount allowed as payment for wallet servers.", "1.0")
|
||||
max_wallet_server_fee = String("Maximum daily LBC amount allowed as payment for wallet servers.", "0.0")
|
||||
|
||||
# reflector settings
|
||||
reflect_streams = Toggle(
|
||||
|
|
|
@ -64,6 +64,8 @@ class WalletServerPayer:
|
|||
self._on_payment_controller.add(tx)
|
||||
|
||||
async def start(self, ledger=None, wallet=None):
|
||||
if lbc_to_dewies(self.max_fee) < 1:
|
||||
return
|
||||
self.ledger = ledger
|
||||
self.wallet = wallet
|
||||
self.running = True
|
||||
|
|
|
@ -57,6 +57,13 @@ class TestUsagePayment(CommandTestCase):
|
|||
async def test_single_server_payment(self):
|
||||
wallet_pay_service = self.daemon.component_manager.get_component('wallet_server_payments')
|
||||
wallet_pay_service.payment_period = 1
|
||||
# only starts with a positive max key fee
|
||||
wallet_pay_service.max_fee = "0.0"
|
||||
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
|
||||
self.assertFalse(wallet_pay_service.running)
|
||||
wallet_pay_service.max_fee = "1.0"
|
||||
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
|
||||
self.assertTrue(wallet_pay_service.running)
|
||||
await wallet_pay_service.stop()
|
||||
await wallet_pay_service.start(ledger=self.ledger, wallet=self.wallet)
|
||||
|
||||
|
|
Loading…
Reference in a new issue