mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
parent
e5ff4fc7cd
commit
251db638af
3 changed files with 15 additions and 5 deletions
|
@ -186,8 +186,10 @@ def _prepare_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1():
|
||||||
|
|
||||||
def do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1():
|
def do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1():
|
||||||
if not _libsecp256k1:
|
if not _libsecp256k1:
|
||||||
raise Exception('libsecp256k1 library not available. '
|
# FIXME logging 'verbosity' is not yet initialised
|
||||||
'Verifying Lightning channels is too computationally expensive without libsecp256k1, aborting.')
|
_logger.info('libsecp256k1 library not available, falling back to python-ecdsa. '
|
||||||
|
'This means signing operations will be slower.')
|
||||||
|
return
|
||||||
if not _patched_functions.prepared_to_patch:
|
if not _patched_functions.prepared_to_patch:
|
||||||
raise Exception("can't patch python-ecdsa without preparations")
|
raise Exception("can't patch python-ecdsa without preparations")
|
||||||
ecdsa.ecdsa.Private_key.sign = _patched_functions.fast_sign
|
ecdsa.ecdsa.Private_key.sign = _patched_functions.fast_sign
|
||||||
|
|
|
@ -36,6 +36,7 @@ from .lntransport import LNTransport, LNResponderTransport
|
||||||
from .lnpeer import Peer, LN_P2P_NETWORK_TIMEOUT
|
from .lnpeer import Peer, LN_P2P_NETWORK_TIMEOUT
|
||||||
from .lnaddr import lnencode, LnAddr, lndecode
|
from .lnaddr import lnencode, LnAddr, lndecode
|
||||||
from .ecc import der_sig_from_sig_string
|
from .ecc import der_sig_from_sig_string
|
||||||
|
from .ecc_fast import is_using_fast_ecc
|
||||||
from .lnchannel import Channel, ChannelJsonEncoder
|
from .lnchannel import Channel, ChannelJsonEncoder
|
||||||
from . import lnutil
|
from . import lnutil
|
||||||
from .lnutil import (Outpoint, calc_short_channel_id, LNPeerAddr,
|
from .lnutil import (Outpoint, calc_short_channel_id, LNPeerAddr,
|
||||||
|
@ -251,6 +252,7 @@ class LNGossip(LNWorker):
|
||||||
self.localfeatures |= LnLocalFeatures.GOSSIP_QUERIES_OPT
|
self.localfeatures |= LnLocalFeatures.GOSSIP_QUERIES_OPT
|
||||||
self.localfeatures |= LnLocalFeatures.GOSSIP_QUERIES_REQ
|
self.localfeatures |= LnLocalFeatures.GOSSIP_QUERIES_REQ
|
||||||
self.unknown_ids = set()
|
self.unknown_ids = set()
|
||||||
|
assert is_using_fast_ecc(), "verifying LN gossip msgs without libsecp256k1 is hopeless"
|
||||||
|
|
||||||
def start_network(self, network: 'Network'):
|
def start_network(self, network: 'Network'):
|
||||||
super().start_network(network)
|
super().start_network(network)
|
||||||
|
|
12
run_electrum
12
run_electrum
|
@ -329,8 +329,6 @@ if __name__ == '__main__':
|
||||||
# todo: defer this to gui
|
# todo: defer this to gui
|
||||||
config = SimpleConfig(config_options)
|
config = SimpleConfig(config_options)
|
||||||
|
|
||||||
cmdname = config.get('cmd')
|
|
||||||
|
|
||||||
if config.get('testnet'):
|
if config.get('testnet'):
|
||||||
constants.set_testnet()
|
constants.set_testnet()
|
||||||
elif config.get('regtest'):
|
elif config.get('regtest'):
|
||||||
|
@ -338,7 +336,15 @@ if __name__ == '__main__':
|
||||||
elif config.get('simnet'):
|
elif config.get('simnet'):
|
||||||
constants.set_simnet()
|
constants.set_simnet()
|
||||||
elif config.get('lightning') and not config.get('reckless'):
|
elif config.get('lightning') and not config.get('reckless'):
|
||||||
raise Exception('lightning branch not available on mainnet')
|
raise Exception('lightning option not available on mainnet')
|
||||||
|
|
||||||
|
if config.get('lightning'):
|
||||||
|
from electrum.ecc_fast import is_using_fast_ecc
|
||||||
|
if not is_using_fast_ecc():
|
||||||
|
raise Exception('libsecp256k1 library not available. '
|
||||||
|
'Verifying Lightning channels is too computationally expensive without libsecp256k1, aborting.')
|
||||||
|
|
||||||
|
cmdname = config.get('cmd')
|
||||||
|
|
||||||
if cmdname == 'daemon' and config.get("detach"):
|
if cmdname == 'daemon' and config.get("detach"):
|
||||||
# fork before creating the asyncio event loop
|
# fork before creating the asyncio event loop
|
||||||
|
|
Loading…
Add table
Reference in a new issue