mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
lnchan: make force_close_tx() assure that tx is valid, trigger failure in test
This commit is contained in:
parent
cf3e050b7e
commit
1d8fe52fa3
2 changed files with 7 additions and 0 deletions
|
@ -868,6 +868,11 @@ class Channel(PrintError):
|
||||||
tx = self.current_commitment(LOCAL)
|
tx = self.current_commitment(LOCAL)
|
||||||
tx.sign({bh2u(self.config[LOCAL].multisig_key.pubkey): (self.config[LOCAL].multisig_key.privkey, True)})
|
tx.sign({bh2u(self.config[LOCAL].multisig_key.pubkey): (self.config[LOCAL].multisig_key.privkey, True)})
|
||||||
remote_sig = self.config[LOCAL].current_commitment_signature
|
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"
|
remote_sig = ecc.der_sig_from_sig_string(remote_sig) + b"\x01"
|
||||||
none_idx = tx._inputs[0]["signatures"].index(None)
|
none_idx = tx._inputs[0]["signatures"].index(None)
|
||||||
tx.add_signature_to_txin(0, none_idx, bh2u(remote_sig))
|
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.
|
# forward since she's sending an outgoing HTLC.
|
||||||
alice_channel.receive_revocation(bobRevocation)
|
alice_channel.receive_revocation(bobRevocation)
|
||||||
|
|
||||||
|
alice_channel.force_close_tx()
|
||||||
|
|
||||||
# test serializing with locked_in htlc
|
# test serializing with locked_in htlc
|
||||||
self.assertEqual(len(alice_channel.to_save()['local_log']), 1)
|
self.assertEqual(len(alice_channel.to_save()['local_log']), 1)
|
||||||
alice_channel.serialize()
|
alice_channel.serialize()
|
||||||
|
|
Loading…
Add table
Reference in a new issue