Skip to content

Commit

Permalink
flake, unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
accumulator committed May 17, 2024
1 parent 3f1ae3d commit 62ea5d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions electrum/lnonion.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_shared_secrets_along_route(payment_path_pubkeys: Sequence[bytes],


def get_shared_secrets_along_route2(payment_path_pubkeys_plus: Sequence[Union[bytes, Tuple[bytes, bytes]]],
session_key: bytes) -> tuple[Sequence[bytes], Sequence[bytes]]:
session_key: bytes) -> Tuple[Sequence[bytes], Sequence[bytes]]:
num_hops = len(payment_path_pubkeys_plus)
hop_shared_secrets = num_hops * [b'']
hop_blinded_node_ids = num_hops * [b'']
Expand Down Expand Up @@ -251,7 +251,7 @@ def new_onion_packet(


def new_onion_packet2(
payment_path_pubkeys: Sequence[Union[bytes, tuple]],
payment_path_pubkeys: Sequence[Union[bytes, Tuple[bytes, bytes]]],
session_key: bytes,
hops_data: Sequence[OnionHopsDataSingle],
*,
Expand Down Expand Up @@ -374,7 +374,7 @@ def process_onion_packet(
onion_packet: OnionPacket,
our_onion_private_key: bytes,
*,
associated_data: bytes = bytes(),
associated_data: bytes = b'',
is_trampoline=False,
tlv_stream_name='payload') -> ProcessedOnionPacket:
if not ecc.ECPubkey.is_pubkey_bytes(onion_packet.public_key):
Expand Down
1 change: 1 addition & 0 deletions electrum/onion_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

if TYPE_CHECKING:
from electrum.lnworker import LNWallet
from electrum.network import Network

logger = get_logger(__name__)

Expand Down
9 changes: 8 additions & 1 deletion tests/test_bolt12.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,15 @@ def test_serde_complex_fields(self):
]}
}

with self.assertRaises(Exception):
# assertRaises on generic Exception used in lnmsg encode/write_tlv_stream makes flake8 complain
# so work around this for now (TODO: refactor lnmsg generic exceptions)
#with self.assertRaises(Exception):
try:
invreq_pl_tlv = encode_invoice_request(invreq, payer_key=payer_key)
except Exception as e:
pass
else:
raise Exception('Exception expected')

# test complex field count matches parameters
invreq = {
Expand Down

0 comments on commit 62ea5d6

Please sign in to comment.