mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
pytest: add test_reconnect_remote_sends_no_sigs, which tests PR2619
Remote node may (incorrectly) not send announcement_signatures when reconnecting, so we we use a copy and can still re-announce. Also checks that we still send our announcement_signatures when reconnecting.
This commit is contained in:
parent
a9dd69002e
commit
b1058dfaca
1 changed files with 33 additions and 0 deletions
|
@ -601,6 +601,39 @@ def test_shutdown_reconnect(node_factory):
|
||||||
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
|
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
|
||||||
|
|
||||||
|
|
||||||
|
@flaky
|
||||||
|
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
||||||
|
def test_reconnect_remote_sends_no_sigs(node_factory):
|
||||||
|
"""We re-announce, even when remote node doesn't send its announcement_signatures on reconnect.
|
||||||
|
"""
|
||||||
|
l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts={'may_reconnect': True})
|
||||||
|
|
||||||
|
# When l1 restarts (with rescan=1), make it think it hasn't
|
||||||
|
# reached announce_depth, so it wont re-send announcement_signatures
|
||||||
|
def no_blocks_above(req):
|
||||||
|
if req['params'][0] > 107:
|
||||||
|
return {"result": None,
|
||||||
|
"error": {"code": -8, "message": "Block height out of range"}, "id": req['id']}
|
||||||
|
else:
|
||||||
|
return {'result': l1.bitcoin.rpc.getblockhash(req['params'][0]),
|
||||||
|
"error": None, 'id': req['id']}
|
||||||
|
|
||||||
|
l1.daemon.rpcproxy.mock_rpc('getblockhash', no_blocks_above)
|
||||||
|
l1.restart()
|
||||||
|
|
||||||
|
# l2 will now uses (REMOTE's) announcement_signatures it has stored
|
||||||
|
wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [
|
||||||
|
'CHANNELD_NORMAL:Reconnected, and reestablished.',
|
||||||
|
'CHANNELD_NORMAL:Funding transaction locked. Channel announced.'])
|
||||||
|
|
||||||
|
# But l2 still sends its own sigs on reconnect
|
||||||
|
l2.daemon.wait_for_logs([r'peer_out WIRE_ANNOUNCEMENT_SIGNATURES',
|
||||||
|
r'peer_out WIRE_ANNOUNCEMENT_SIGNATURES'])
|
||||||
|
|
||||||
|
# l1 only did send them the first time
|
||||||
|
assert(''.join(l1.daemon.logs).count(r'peer_out WIRE_ANNOUNCEMENT_SIGNATURES') == 1)
|
||||||
|
|
||||||
|
|
||||||
def test_shutdown_awaiting_lockin(node_factory, bitcoind):
|
def test_shutdown_awaiting_lockin(node_factory, bitcoind):
|
||||||
l1 = node_factory.get_node()
|
l1 = node_factory.get_node()
|
||||||
l2 = node_factory.get_node(options={'funding-confirms': 3})
|
l2 = node_factory.get_node(options={'funding-confirms': 3})
|
||||||
|
|
Loading…
Add table
Reference in a new issue