1
0

add lnchannel.can_send_ctx_updates. just drop illegal updates for now

This commit is contained in:
SomberNight
2020-02-26 20:35:46 +01:00
parent 9d1fa4cc99
commit e54c69b861
4 changed files with 56 additions and 17 deletions

View File

@@ -157,13 +157,12 @@ def create_test_channels(feerate=6000, local=None, remote=None):
alice_second = lnutil.secret_to_pubkey(int.from_bytes(lnutil.get_per_commitment_secret_from_seed(alice_seed, lnutil.RevocationStore.START_INDEX - 1), "big"))
bob_second = lnutil.secret_to_pubkey(int.from_bytes(lnutil.get_per_commitment_secret_from_seed(bob_seed, lnutil.RevocationStore.START_INDEX - 1), "big"))
alice.config[REMOTE].next_per_commitment_point = bob_second
alice.config[REMOTE].current_per_commitment_point = bob_first
bob.config[REMOTE].next_per_commitment_point = alice_second
bob.config[REMOTE].current_per_commitment_point = alice_first
alice.open_with_first_pcp(bob_first, sig_from_bob)
bob.open_with_first_pcp(alice_first, sig_from_alice)
alice.hm.channel_open_finished()
bob.hm.channel_open_finished()
# from funding_locked:
alice.config[REMOTE].next_per_commitment_point = bob_second
bob.config[REMOTE].next_per_commitment_point = alice_second
# TODO: sweep_address in lnchannel.py should use static_remotekey
alice.sweep_address = bitcoin.pubkey_to_address('p2wpkh', alice.config[LOCAL].payment_basepoint.pubkey.hex())

View File

@@ -225,6 +225,8 @@ class TestPeer(ElectrumTestCase):
def test_reestablish(self):
alice_channel, bob_channel = create_test_channels()
p1, p2, w1, w2, _q1, _q2 = self.prepare_peers(alice_channel, bob_channel)
for chan in (alice_channel, bob_channel):
chan.peer_state = peer_states.DISCONNECTED
async def reestablish():
await asyncio.gather(
p1.reestablish_channel(alice_channel),
@@ -254,6 +256,8 @@ class TestPeer(ElectrumTestCase):
run(f())
p1, p2, w1, w2, _q1, _q2 = self.prepare_peers(alice_channel_0, bob_channel)
for chan in (alice_channel_0, bob_channel):
chan.peer_state = peer_states.DISCONNECTED
async def reestablish():
await asyncio.gather(
p1.reestablish_channel(alice_channel_0),