get_preimage_script should really have been private API...
looks like everywhere it is used outside of transaction.py, it is actually abused :/
Other existing usages in plugin code I don't dare to touch without lots of manual testing...
In fact, semantically it might be more correct to only trigger 'blockchain_updated' and not 'network_updated' here...
Anyway, 'blockchain_updated' should be triggered whenever the Blockchain object gets longer (or changes otherwise).
In particular, in qml, the NetworkOverview only updates the displayed height on 'blockchain_updated'.
Values for exponential search are based on available fee budget:
we try with budget/64, budget/32, ..., budget/1 (spread uniformly among the selected Trampoline Forwarders).
Hence, if we make the fee budget configurable, that will usefully affect the trampoline fees as well.
related https://github.com/spesmilo/electrum/issues/9033
Instead of some functions operating with hex strings,
and others using bytes, this consolidates most things to use bytes.
This mainly focuses on bitcoin.py and transaction.py,
and then adapts the API usages in other files.
Notably,
- scripts,
- pubkeys,
- signatures
should be bytes in almost all places now.
This avoids some false negatives for is_proxy_tor.
(previously we only set is_proxy_tor when the proxy settings were changed)
In particular, consider scenario:
- Tor browser not running
- user sets "localhost:9150" as proxy
- detection sets network.is_proxy_tor to False
- user starts Tor browser
- network, due to retries, finds proxy working and connects to some servers
- network.is_proxy_tor remains False
- `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'
```