diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index d0fc21c99..7bd731617 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -1151,6 +1151,25 @@ class Daemon(metaclass=JSONRPCServerType): wallet.save() return {key: value} + def jsonrpc_preference_clear(self, key, wallet_id=None): + """ + Clear daemon preference + + Usage: + preference_clear () [--wallet_id=] + + Options: + --key= : (str) key associated with value + --wallet_id= : (str) restrict operation to specific wallet + + Returns: + (dict) Updated dictionary of daemon preferences + """ + wallet = self.wallet_manager.get_wallet_or_default(wallet_id) + del wallet.preferences[key] + wallet.save() + return wallet.preferences.to_dict_without_ts() + WALLET_DOC = """ Create, modify and inspect wallets. """ diff --git a/tests/integration/blockchain/test_wallet_commands.py b/tests/integration/blockchain/test_wallet_commands.py index 8500efa3c..48f784ac2 100644 --- a/tests/integration/blockchain/test_wallet_commands.py +++ b/tests/integration/blockchain/test_wallet_commands.py @@ -239,6 +239,14 @@ class WalletEncryptionAndSynchronization(CommandTestCase): {"one": "1", "two": "2", "conflict": "2", "another": "B", "fruit": ["peach", "apricot"]} ) + daemon.jsonrpc_preference_clear("one") + + self.assertDictEqual( + # "two" key added and "conflict" value changed to "2" + daemon.jsonrpc_preference_get(), + {"two": "2", "conflict": "2", "another": "B", "fruit": ["peach", "apricot"]} + ) + # Channel Certificate channel = await daemon2.jsonrpc_channel_create('@foo', '0.1') await self.confirm_tx(channel.id, self.daemon2.ledger)