tfix local_index in channel _shutdown - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 023d4026b95078ee33e7f242c8d1f95189709598 DIR parent 3abe30e9d8a383fe88bd9edd23b3be749e9c1c03 HTML Author: ThomasV <thomasv@electrum.org> Date: Thu, 14 Mar 2019 09:47:51 +0100 fix local_index in channel _shutdown Diffstat: M electrum/lnchannel.py | 2 +- M electrum/lnpeer.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) --- DIR diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py t@@ -756,7 +756,7 @@ class Channel(PrintError): htlcs=htlcs) 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, fee_sat: int) -> Tuple[bytes, int, str]: DIR diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py t@@ -1155,11 +1155,10 @@ class Peer(PrintError): # TODO: negociate better our_fee = their_fee # index of our_sig - i = bool(chan.get_local_index()) - if not is_local: i = not i + i = chan.get_local_index() # 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, int(not i), bh2u(der_sig_from_sig_string(their_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, 1-i, bh2u(der_sig_from_sig_string(their_sig) + b'\x01')) # broadcast await self.network.broadcast_transaction(closing_tx) return closing_tx.txid()