diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 6326702a8..a1265cd88 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -2609,16 +2609,8 @@ class Daemon(metaclass=JSONRPCServerType): elif old_txo.claim.is_signed and not clear_channel and not replace: channel = old_txo.channel - fee_address = self.get_fee_address(kwargs, old_txo.claim.stream.fee.address or claim_address) - if fee_address: - kwargs['fee_address'] = fee_address - kwargs['fee_currency'] = kwargs.get('fee_currency', old_txo.claim.stream.fee.currency if not replace else None) - kwargs['fee_amount'] = kwargs.get('fee_amount', old_txo.claim.stream.fee.amount if not replace else None) - valid_currency = kwargs['fee_currency'] if kwargs['fee_currency'] != 'UNKNOWN_CURRENCY' else None - if kwargs.get('fee_amount') and not valid_currency: - raise Exception('In order to set a fee amount, please specify a fee currency') - if valid_currency and not kwargs.get('fee_amount'): - raise Exception('In order to set a fee currency, please specify a fee amount') + if {'fee_currency', 'fee_amount', 'fee_address'}.intersection(kwargs): + kwargs['fee_address'] = self.get_fee_address(kwargs, old_txo.claim.stream.fee.address or claim_address) if replace: claim = Claim() diff --git a/lbrynet/schema/attrs.py b/lbrynet/schema/attrs.py index d0ddebbfd..acbf87627 100644 --- a/lbrynet/schema/attrs.py +++ b/lbrynet/schema/attrs.py @@ -204,12 +204,18 @@ class Fee(Metadata): __slots__ = () def update(self, address: str = None, currency: str = None, amount=None): + amount = amount or self.amount + currency = currency or (self.currency if self.message.currency else None) if address is not None: self.address = address - if (self.message.currency or currency is not None) and amount is not None: + if currency and amount: currency = currency.lower() if currency is not None else self.currency.lower() assert currency in ('lbc', 'btc', 'usd'), f'Unknown currency type: {currency}' - setattr(self, currency, Decimal(amount)) + setattr(self, currency, Decimal(amount or self.amount)) + elif amount and not currency: + raise Exception('In order to set a fee amount, please specify a fee currency') + elif currency and not amount: + raise Exception('In order to set a fee currency, please specify a fee amount') @property def currency(self) -> str: diff --git a/lbrynet/schema/claim.py b/lbrynet/schema/claim.py index ff47a19c7..9fa304f37 100644 --- a/lbrynet/schema/claim.py +++ b/lbrynet/schema/claim.py @@ -206,8 +206,6 @@ class Stream(BaseClaim): def update(self, file_path=None, height=None, width=None, duration=None, **kwargs): if kwargs.pop('clear_fee', False): - # clear_fee is set, ignore defaults - kwargs.pop('fee_address', None), kwargs.pop('fee_currency', None), kwargs.pop('fee_amount', None) self.message.ClearField('fee') else: self.fee.update(