From 6421cecafba2498c9014ca93311964e24ed74840 Mon Sep 17 00:00:00 2001 From: belikor Date: Sun, 18 Jul 2021 11:53:51 -0500 Subject: [PATCH] daemon: fix `--claim_id` with `lbrynet claim search` For some reason, when using `claim_search` with `--claim_id`, the arguments dictionary will also contain `claim_ids` with an empty list, even if we didn't specify it. ``` lbrynet claim search --claim_id=8945573bcfcb7f8276187dfbb93545eac4ebf71a ``` Using both `claim_id` and `claim_ids` will raise a `ValueError` exception so the daemon won't return a valid result even if the claim ID is in fact valid. So if `claim_id` exists, we need to discard `claim_ids` if it is empty, before proceeding with the rest of the code. On the other hand, if `claim_ids` is used, and `claim_id` is absent, there will be no problem as `claim_id` won't be added to the dictionary. ``` lbrynet claim search --claim_ids=8945573bcfcb7f8276187dfbb93545eac4ebf71a ``` --- lbry/extras/daemon/daemon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index b766a27b7..e66bfd95d 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -2479,6 +2479,8 @@ class Daemon(metaclass=JSONRPCServerType): Returns: {Paginated[Output]} """ wallet = self.wallet_manager.get_wallet_or_default(kwargs.pop('wallet_id', None)) + if "claim_ids" in kwargs and not kwargs["claim_id"]: + kwargs.pop("claim_ids") if {'claim_id', 'claim_ids'}.issubset(kwargs): raise ValueError("Only 'claim_id' or 'claim_ids' is allowed, not both.") if kwargs.pop('valid_channel_signature', False):