- `bitstring` started depending on `bitarray` in version 4.1 [0]
- that would mean one additional dependency for us (from yet another maintainer), which is not even pure python
- we only use bitstring for bolt11-parsing
- hence this PR rewrites the bolt11-parsing and removes `bitstring` as dependency
- note: I benchmarked lndecode using [1], and the new code performs better,
taking around 80% time needed for old code (when using bitstring 3.1.9, pure python).
Though the variance is quite large in both cases.
[0]: 95ee533ee4/release_notes.txt (L108)
[1]: d7597d96d0
follow-up https://github.com/spesmilo/electrum/pull/8713
```
1.35 | E | __main__ | daemon.run_gui errored
Traceback (most recent call last):
File "/home/user/wspace/electrum/./run_electrum", line 458, in handle_cmd
d.run_gui()
File "/home/user/wspace/electrum/electrum/daemon.py", line 623, in run_gui
self.gui_object = gui.ElectrumGui(config=self.config, daemon=self, plugins=self._plugins)
File "/home/user/wspace/electrum/electrum/util.py", line 482, in do_profile
o = func(*args, **kw_args)
File "/home/user/wspace/electrum/electrum/gui/qml/__init__.py", line 82, in __init__
self.app = ElectrumQmlApplication(sys.argv, config=config, daemon=daemon, plugins=plugins)
File "/home/user/wspace/electrum/electrum/gui/qml/qeapp.py", line 428, in __init__
self.plugins.load_plugin('trustedcoin')
File "/home/user/wspace/electrum/electrum/plugin.py", line 269, in load_plugin
raise Exception(f"could not find plugin {name!r}")
Exception: could not find plugin 'trustedcoin'
```
- CoinGecko restricted its historical API to last 365 days
- we used to ask for, and get, the whole history, but now we can only ask for the last year
- so change HTTP request to only ask for 365 days
- we cache historical rates to disk
- previously we used to overwrite what is already stored, with the newly obtained data
- now this is changed so that we merge the new data into the already stored data
It would be simple to hard fail at import time if any of the interesting
libsecp modules are missing, as it was done before this commit. However,
some Linux distros (atm current ubuntu lts, 22.04) lack new enough libsecp.
Also, for now, we don't use the schnorr APIs yet anyway. Until we start
to rely on them more, it is feasible to only require them when they are
used.
I am hoping we will be able to revert this commit later though, to keep
things simple.
I decided to use the stdlib (hashlib) instead of libsecp for this,
as it is simple enough, and the former is faster on my PC.
Added a unit test that compares the two.