Browse Source

fix local_index in channel _shutdown

regtest_lnd
ThomasV 6 years ago
committed by SomberNight
parent
commit
ac0aa1b0c7
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/lnchannel.py
  2. 7
      electrum/lnpeer.py

2
electrum/lnchannel.py

@ -756,7 +756,7 @@ class Channel(PrintError):
htlcs=htlcs) htlcs=htlcs)
def get_local_index(self): def get_local_index(self):
return int(self.config[LOCAL].multisig_key.pubkey < self.config[REMOTE].multisig_key.pubkey) return int(self.config[LOCAL].multisig_key.pubkey > self.config[REMOTE].multisig_key.pubkey)
def make_closing_tx(self, local_script: bytes, remote_script: bytes, def make_closing_tx(self, local_script: bytes, remote_script: bytes,
fee_sat: int) -> Tuple[bytes, int, str]: fee_sat: int) -> Tuple[bytes, int, str]:

7
electrum/lnpeer.py

@ -1155,11 +1155,10 @@ class Peer(PrintError):
# TODO: negociate better # TODO: negociate better
our_fee = their_fee our_fee = their_fee
# index of our_sig # index of our_sig
i = bool(chan.get_local_index()) i = chan.get_local_index()
if not is_local: i = not i
# add signatures # add signatures
closing_tx.add_signature_to_txin(0, int(i), bh2u(der_sig_from_sig_string(our_sig) + b'\x01')) closing_tx.add_signature_to_txin(0, i, bh2u(der_sig_from_sig_string(our_sig) + b'\x01'))
closing_tx.add_signature_to_txin(0, int(not i), bh2u(der_sig_from_sig_string(their_sig) + b'\x01')) closing_tx.add_signature_to_txin(0, 1-i, bh2u(der_sig_from_sig_string(their_sig) + b'\x01'))
# broadcast # broadcast
await self.network.broadcast_transaction(closing_tx) await self.network.broadcast_transaction(closing_tx)
return closing_tx.txid() return closing_tx.txid()

Loading…
Cancel
Save