Browse Source
lnchan: make force_close_tx() assure that tx is valid, trigger failure in test
regtest_lnd
Janus
6 years ago
committed by
SomberNight
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
7 additions and
0 deletions
-
electrum/lnchan.py
-
electrum/tests/test_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)) |
|
|
|
|
|
@ -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() |
|
|
|