Browse Source

labels plugin: handle setting a label to None

patch-4
ThomasV 3 years ago
parent
commit
ad9030bd15
  1. 10
      electrum/plugins/labels/labels.py

10
electrum/plugins/labels/labels.py

@ -65,12 +65,17 @@ class LabelsPlugin(BasePlugin):
return
if not item:
return
if label is None:
# note: the server does not know whether a label is empty
label = ''
nonce = self.get_nonce(wallet)
wallet_id = self.wallets[wallet][2]
bundle = {"walletId": wallet_id,
bundle = {
"walletId": wallet_id,
"walletNonce": nonce,
"externalId": self.encode(wallet, item),
"encryptedLabel": self.encode(wallet, label)}
"encryptedLabel": self.encode(wallet, label)
}
asyncio.run_coroutine_threadsafe(self.do_post_safe("/label", bundle), wallet.network.asyncio_loop)
# Caller will write the wallet
self.set_nonce(wallet, nonce + 1)
@ -145,6 +150,7 @@ class LabelsPlugin(BasePlugin):
except:
self.logger.info(f'error: no json {key}')
continue
if value:
result[key] = value
for key, value in result.items():

Loading…
Cancel
Save