mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 09:34:24 +01:00
close: add notification for slow closes.
For compatibility, we only do this if `allow-deprecated-apis` is false for now. Otherwise scripts parsing should use `grep -v '^# '` or start using `-N none`. Changelog-Added: JSON-RPC: `close` now sends notifications for slow closes (if `allow-deprecated-apis`=false) Changelog-Deprecated: cli: scripts should filter out '^# ' or use `-N none`, as commands will start returning notifications soon Fixes: #3925 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -4,13 +4,14 @@ from pyln.client import RpcError
|
||||
from shutil import copyfile
|
||||
from utils import (
|
||||
only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT,
|
||||
account_balance, first_channel_id, basic_fee
|
||||
account_balance, first_channel_id, basic_fee, TEST_NETWORK,
|
||||
)
|
||||
|
||||
import os
|
||||
import queue
|
||||
import pytest
|
||||
import re
|
||||
import subprocess
|
||||
import threading
|
||||
import unittest
|
||||
|
||||
@@ -126,6 +127,25 @@ def test_closing_while_disconnected(node_factory, bitcoind, executor):
|
||||
wait_for(lambda: len(l2.rpc.listchannels()['channels']) == 0)
|
||||
|
||||
|
||||
def test_closing_disconnected_notify(node_factory, bitcoind, executor):
|
||||
l1, l2 = node_factory.line_graph(2)
|
||||
|
||||
l1.pay(l2, 200000000)
|
||||
l2.stop()
|
||||
wait_for(lambda: not only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['connected'])
|
||||
|
||||
out = subprocess.check_output(['cli/lightning-cli',
|
||||
'--network={}'.format(TEST_NETWORK),
|
||||
'--lightning-dir={}'
|
||||
.format(l1.daemon.lightning_dir),
|
||||
'close',
|
||||
l2.info['id'],
|
||||
'5']).decode('utf-8').splitlines()
|
||||
assert out[0] == '# peer is offline, will negotiate once they reconnect (5 seconds before unilateral close).'
|
||||
assert out[1] == '# Timed out, forcing close.'
|
||||
assert not any([line.startswith('#') for line in out[2:]])
|
||||
|
||||
|
||||
def test_closing_id(node_factory):
|
||||
"""Test closing using peer ID and full channel ID
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user