electrum
electrum copied to clipboard
Labels export does not reflect what is on History tab
I think the History tab takes some Labels from OTHER PLACES and displays them as if it was the transaction's label. And those are not exported. But there is no visual clue of this, and this results in loss of labels on export.
To reproduce:
- I exported my labels and had only 3 lines in the JSON file.
- While my History tab has 5 transaction that have Labels.
Later, I deleted a Payment Request, because I received that, but due to amount not matching, it was not "removed" from Receive tab and not auto-moved to History. That's OK... ;-)
-
After deleting Request, one of the 5 labels disappeared from History! Thus I realized, that was not exported most likely because it "automatically came" from Receive tab. So I added it on History tab. Now it is exported.
-
Then I had hard time finding the 5th label, and found it on Coins tab. I don't know how I added it there, because Coins list provides no options to modify the labels. (That may be a separate report, that there are labels there which cannot be edited. I can see the same address in Addresses, but it does not have a label.) (This history entry is a SEND transaction, so I guess I specified this when sending the money.)
-
If I open this labeled Transaction (on History tab), the label is visible there as comment. But pressing "Close" does not change anything, because I do not change the label. Thus export at this stage still does not contain this one, despite it's on History and not editable at Coins, and attempted to "save" it into the transaction.
-
Then I changed this label a bit on History (added a letter to it), now finally the Export contains this one too.
Thus my error report is, that there is totally no way on History to know whether what I see is really exported.
I understand that they are not exported because (probably) they belong to addresses and not transaction. But this is very confusing. (I want to copy all my older labels from an older system, but I wonder how many of my labels are "not real" there...? And there is no way to know, no way to SAVE ("update" without editing)...)
Expected behavior:
Export what I see on History tab.
However as I understand, that in case, importing would assign Address labels to Transactions. ??
Thanks. I hope this report is understandable. I'm not sure my assumptions are correct.
Right, this is a bit complex. In short, there are three sources of labels atm,
- the
wallet._labels
dictionary - descriptions for "invoices" (send tab)
- descriptions for "requests" (receive tab)
You can see the convolutedness around here: https://github.com/spesmilo/electrum/blob/57270e3bf3c4c1f6cad9b5fba3ca38d0308ed613/electrum/wallet.py#L1611
When you export labels, only wallet._labels
is exported.
However you can export/import both invoices and requests. Have you tried doing all 3?
Thanks, yes, that is understandable, but very confusing to user, and not user friendly.
My first example label was still on "Receive" tab, thus it was visible on History but not exported with History. Then I deleted the Request, that "eliminated" the label from History - this is already confusing, as I expected History "knows" that label, because it was displayed there.
My second example, that label we NOT on my "Send" tab, because the transaction got auto-moved to History when it was completed, months ago. Thus the label came from a place not visible to user (however as mentioned, I found it in "Coins", where it is not editable. Still, I had no way to "burn that label into the History" without modifying its content.)
I have not tried to export/import Send and Receive, because there was NOTHING on them. (at this point)
Now, I went to my old PC from where I want to move all my old labels. "Shockingly" (sorry ;) ) the export contains less than half of my labels, while seemingly all transactions have a label on History.
(Send and Receive tabs are EMPTY. But even more confusingly, if I export them, there is data in both files! So I export the nothing, and there is something.)
I do not plan to copy this non-visible Invoice/Request data from my old PC to the new, because I do not understand what this contains. I just want to copy my Historic labels. History labels export file looks simple and understandable.
Maybe it's not technically a good solution but maybe History labels export should do as your linked code?? At least that would provide a way for user to copy transaction history notes as it is visible.
return self._labels.get(tx_hash) or self._get_default_label_for_txid(tx_hash)
Off note: Interestingly, one item on my History export JSON contains an address, not a transaction ID. (However that transaction may be from an older Electrum version. That is the first transaction.)