1
0

handle_error_code_from_failed_htlc: omg brainfart :(

follow-up 85841ba20d
This commit is contained in:
SomberNight
2020-06-24 21:33:44 +02:00
parent c2111a2616
commit 10c2183461
2 changed files with 46 additions and 16 deletions

View File

@@ -11,6 +11,7 @@ from electrum.lnutil import (RevocationStore, get_per_commitment_secret_from_see
ScriptHtlc, extract_nodeid, calc_fees_for_commitment_tx, UpdateAddHtlc, LnFeatures)
from electrum.util import bh2u, bfh, MyEncoder
from electrum.transaction import Transaction, PartialTransaction
from electrum.lnworker import LNWallet
from . import ElectrumTestCase
@@ -805,3 +806,23 @@ class TestLNUtil(ElectrumTestCase):
features.for_invoice())
features = LnFeatures.BASIC_MPP_OPT | LnFeatures.PAYMENT_SECRET_REQ | LnFeatures.VAR_ONION_REQ
self.assertEqual(features, features.for_invoice())
def test_lnworker_decode_channel_update_msg(self):
msg_without_prefix = bytes.fromhex("439b71c8ddeff63004e4ff1f9764a57dcf20232b79d9d669aef0e31c42be8e44208f7d868d0133acb334047f30e9399dece226ccd98e5df5330adf7f356290516fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000008762700054a00005ef2cf9c0101009000000000000003e80000000000000001000000002367b880")
# good messages
self.assertNotEqual(
None,
LNWallet._decode_channel_update_msg(msg_without_prefix))
self.assertNotEqual(
None,
LNWallet._decode_channel_update_msg(bytes.fromhex("0102") + msg_without_prefix))
# bad messages
self.assertEqual(
None,
LNWallet._decode_channel_update_msg(bytes.fromhex("0102030405")))
self.assertEqual(
None,
LNWallet._decode_channel_update_msg(bytes.fromhex("ffff") + msg_without_prefix))
self.assertEqual(
None,
LNWallet._decode_channel_update_msg(bytes.fromhex("0101") + msg_without_prefix))