electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 1d8fe52fa3d54cceb034d44ccea98a3b54eaebe9
parent cf3e050b7e58d46fda20959125f081f3264a3f28
Author: Janus <ysangkok@gmail.com>
Date:   Mon, 17 Dec 2018 15:27:34 +0100

lnchan: make force_close_tx() assure that tx is valid, trigger failure in test

Diffstat:
Melectrum/lnchan.py | 5+++++
Melectrum/tests/test_lnchan.py | 2++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/electrum/lnchan.py b/electrum/lnchan.py @@ -868,6 +868,11 @@ class Channel(PrintError): tx = self.current_commitment(LOCAL) tx.sign({bh2u(self.config[LOCAL].multisig_key.pubkey): (self.config[LOCAL].multisig_key.privkey, True)}) remote_sig = self.config[LOCAL].current_commitment_signature + + preimage_hex = tx.serialize_preimage(0) + pre_hash = sha256d(bfh(preimage_hex)) + assert ecc.verify_signature(self.config[REMOTE].multisig_key.pubkey, remote_sig, pre_hash) + remote_sig = ecc.der_sig_from_sig_string(remote_sig) + b"\x01" none_idx = tx._inputs[0]["signatures"].index(None) tx.add_signature_to_txin(0, none_idx, bh2u(remote_sig)) diff --git a/electrum/tests/test_lnchan.py b/electrum/tests/test_lnchan.py @@ -237,6 +237,8 @@ class TestChannel(unittest.TestCase): # forward since she's sending an outgoing HTLC. alice_channel.receive_revocation(bobRevocation) + alice_channel.force_close_tx() + # test serializing with locked_in htlc self.assertEqual(len(alice_channel.to_save()['local_log']), 1) alice_channel.serialize()