diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py index 43c2f7e67..54e5296da 100644 --- a/electrum/lnpeer.py +++ b/electrum/lnpeer.py @@ -474,7 +474,7 @@ class Peer(Logger): funding_locked_received=False, was_announced=False, current_commitment_signature=None, - current_htlc_signatures=[], + current_htlc_signatures=b'', ) return local_config @@ -1487,10 +1487,10 @@ class Peer(Logger): our_fee = their_fee # add signatures closing_tx.add_signature_to_txin(txin_idx=0, - signing_pubkey=chan.config[LOCAL].multisig_key.pubkey, + signing_pubkey=chan.config[LOCAL].multisig_key.pubkey.hex(), sig=bh2u(der_sig_from_sig_string(our_sig) + b'\x01')) closing_tx.add_signature_to_txin(txin_idx=0, - signing_pubkey=chan.config[REMOTE].multisig_key.pubkey, + signing_pubkey=chan.config[REMOTE].multisig_key.pubkey.hex(), sig=bh2u(der_sig_from_sig_string(their_sig) + b'\x01')) # broadcast await self.network.broadcast_transaction(closing_tx) diff --git a/electrum/lnutil.py b/electrum/lnutil.py index 63921e85c..711265a85 100644 --- a/electrum/lnutil.py +++ b/electrum/lnutil.py @@ -27,8 +27,14 @@ if TYPE_CHECKING: HTLC_TIMEOUT_WEIGHT = 663 HTLC_SUCCESS_WEIGHT = 703 -Keypair = namedtuple("Keypair", ["pubkey", "privkey"]) -OnlyPubkeyKeypair = namedtuple("OnlyPubkeyKeypair", ["pubkey"]) + +class Keypair(NamedTuple): + pubkey: bytes + privkey: bytes + + +class OnlyPubkeyKeypair(NamedTuple): + pubkey: bytes # NamedTuples cannot subclass NamedTuples :'( https://github.com/python/typing/issues/427 @@ -55,19 +61,19 @@ class LocalConfig(NamedTuple): class RemoteConfig(NamedTuple): # shared channel config fields (DUPLICATED code!!) - payment_basepoint: 'Keypair' - multisig_key: 'Keypair' - htlc_basepoint: 'Keypair' - delayed_basepoint: 'Keypair' - revocation_basepoint: 'Keypair' + payment_basepoint: Union['Keypair', 'OnlyPubkeyKeypair'] + multisig_key: Union['Keypair', 'OnlyPubkeyKeypair'] + htlc_basepoint: Union['Keypair', 'OnlyPubkeyKeypair'] + delayed_basepoint: Union['Keypair', 'OnlyPubkeyKeypair'] + revocation_basepoint: Union['Keypair', 'OnlyPubkeyKeypair'] to_self_delay: int dust_limit_sat: int max_htlc_value_in_flight_msat: int max_accepted_htlcs: int initial_msat: int reserve_sat: int - htlc_minimum_msat: int # specific to "REMOTE" config + htlc_minimum_msat: int next_per_commitment_point: bytes revocation_store: 'RevocationStore' current_per_commitment_point: Optional[bytes]