I'm not sure that either feature will be appealing to the Electrum developers since both suggestions would take away from the user-friendliness of the wallet.
I don't think so.
For the first option, it could be only a single additional item in the menu, and possibly a new color for the address list to show the excluded addresses (e.g. red or orange; yellow, green and blue are already used). Users would barely notice the change. The possibility to sync only a subset of addresses should be optional, possibly it could be selected during the configuration of a new wallet.
For the second option, it should be completely optional feature, i.e. if you dont enable it when starting the wallet or afterwards in your options, users would not be bothered by it.
The way Electrum counts your coins is by syncing with the SPV server on startup, and I can't see them wanting to change that.
I found the part of the code where this syncing takes place, it's the Synchronizer class in
synchronizer.py:
async def main(self):
self.adb.up_to_date_changed()
# request missing txns, if any
for addr in random_shuffled_copy(self.adb.db.get_history()):
history = self.adb.db.get_addr_history(addr)
# Old electrum servers returned ['*'] when all history for the address
# was pruned. This no longer happens but may remain in old wallets.
if history == ['*']: continue
await self._request_missing_txs(history, allow_server_not_finding_tx=True)
There are two options to exclude addresses:
- a very easy option would be to feed the list of excluded addresses into the main method of the synchronizer and only request addresses not excluded. The question here of course is where the list of excluded addresses should be stored. (Edit: removed code snippet, not necessary to illustrate point as it's trivial.)
- a probably better way: self.adb.db.get_history() seems to be the method which retrieves the addresses from the database. The database methods should be those excluding the addresses in this case, returning only the addresses which are not marked as "excluded" into the for loop shown above.
Again, given the options that the technically astute users have and the lack of public concern for this level of privacy, I don't see the Electrum developers putting much effort into this.
The thing is that I think this is a low hanging fruit and would need few code changes, as shown above. The most relevant change would be the additional column in the address table.
It's even possible that I could code a proof of concept of this myself as I know a little bit of Python ...