diff --git a/lbrynet/schema/attrs.py b/lbrynet/schema/attrs.py index c68060add..da9fa8569 100644 --- a/lbrynet/schema/attrs.py +++ b/lbrynet/schema/attrs.py @@ -217,11 +217,11 @@ class Fee(Metadata): @property def address(self) -> str: - return Base58.encode(self.message.address) + return Base58.encode(self.address_bytes) if self.address_bytes else '' @address.setter def address(self, address: str): - self.message.address = Base58.decode(address) + self.address_bytes = Base58.decode(address) @property def address_bytes(self) -> bytes: diff --git a/lbrynet/stream/stream_manager.py b/lbrynet/stream/stream_manager.py index 332b67cde..63802da59 100644 --- a/lbrynet/stream/stream_manager.py +++ b/lbrynet/stream/stream_manager.py @@ -407,7 +407,7 @@ class StreamManager: msg = f"fee of {fee_amount} exceeds max available balance" log.warning(msg) raise InsufficientFundsError(msg) - fee_address = claim.stream.fee.address + fee_address = claim.stream.fee.address or resolved['address'] stream = ManagedStream( self.loop, self.config, self.blob_manager, claim.stream.source.sd_hash, download_directory, diff --git a/tests/integration/test_file_commands.py b/tests/integration/test_file_commands.py index 1d5ea2979..38b7b6e79 100644 --- a/tests/integration/test_file_commands.py +++ b/tests/integration/test_file_commands.py @@ -259,3 +259,22 @@ class FileCommands(CommandTestCase): await self.daemon.stream_manager.start() self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1) self.assertEqual(self.daemon.jsonrpc_file_list()[0].content_fee.raw, raw_content_fee) + await self.daemon.jsonrpc_file_delete(claim_name='icanpay') + + # PASS: no fee address --> use the claim address to pay + await self.stream_create( + 'nofeeaddress', '0.01', data=b'free stuff?', + ) + await self.stream_update( + claim_id=self.daemon.jsonrpc_file_list()[0].claim_id, + data=b'new price', fee_amount='2.0', fee_currency='LBC', claim_address=target_address + ) + self.assertIs(self.daemon.jsonrpc_file_list()[0].stream_claim_info.claim.stream.fee.address, '') + await self.daemon.jsonrpc_file_delete(claim_name='nofeeaddress') + self.assertEqual(len(self.daemon.jsonrpc_file_list()), 0) + + response = await self.out(self.daemon.jsonrpc_get('lbry://nofeeaddress')) + self.assertIsNotNone(response['content_fee']) + self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1) + self.assertEqual(response['content_fee']['outputs'][0]['amount'], '2.0') + self.assertEqual(response['content_fee']['outputs'][0]['address'], target_address)