commit e54f0fbafa502589a4f197245e46545feeb73a12
parent d9552858085969feaf2ead1cd280e1eaefa30d48
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 16 Aug 2019 22:40:17 +0200
do not raise BaseException
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/electrum/channel_db.py b/electrum/channel_db.py
@@ -36,7 +36,7 @@ from .sql_db import SqlDB, sql
from . import constants
from .util import bh2u, profiler, get_headers_dir, bfh, is_ip_address, list_enabled_bits
from .logging import Logger
-from .lnutil import LN_GLOBAL_FEATURES_KNOWN_SET, LNPeerAddr
+from .lnutil import LN_GLOBAL_FEATURES_KNOWN_SET, LNPeerAddr, format_short_channel_id
from .lnverifier import LNChannelVerifier, verify_sig_for_channel_update
if TYPE_CHECKING:
@@ -430,10 +430,11 @@ class ChannelDB(SqlDB):
def verify_channel_update(self, payload):
short_channel_id = payload['short_channel_id']
+ scid = format_short_channel_id(short_channel_id)
if constants.net.rev_genesis_bytes() != payload['chain_hash']:
raise Exception('wrong chain hash')
if not verify_sig_for_channel_update(payload, payload['start_node']):
- raise BaseException('verify error')
+ raise Exception(f'failed verifying channel update for {scid}')
def add_node_announcement(self, msg_payloads):
if type(msg_payloads) is dict:
diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py
@@ -390,7 +390,7 @@ class Peer(Logger):
elif encoded[0] == 1:
decoded = zlib.decompress(encoded[1:])
else:
- raise BaseException('zlib')
+ raise Exception(f'decode_short_ids: unexpected first byte: {encoded[0]}')
ids = [decoded[i:i+8] for i in range(0, len(decoded), 8)]
return ids