Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splicing test is provided #5

Open
wants to merge 2 commits into
base: ddustin/splice
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc/schemas/listpeerchannels.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@
"FUNDING_SPEND_SEEN",
"ONCHAIN",
"DUALOPEND_OPEN_INIT",
"DUALOPEND_AWAITING_LOCKIN"
"DUALOPEND_AWAITING_LOCKIN",
"CHANNELD_AWAITING_SPLICE"
],
"description": "Previous state"
},
Expand All @@ -395,7 +396,8 @@
"FUNDING_SPEND_SEEN",
"ONCHAIN",
"DUALOPEND_OPEN_INIT",
"DUALOPEND_AWAITING_LOCKIN"
"DUALOPEND_AWAITING_LOCKIN",
"CHANNELD_AWAITING_SPLICE"
],
"description": "New state"
},
Expand Down
17 changes: 16 additions & 1 deletion tests/test_splicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
def test_splice(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True)

# get channel id
chan_id = l1.get_channel_id(l2)


channels = l1.rpc.listpeerchannels()['channels']
original_scid = channels[0].get('short_channel_id')

# add extra sats to pay fee
funds_result = l1.rpc.fundpsbt("109000sat", "slow", 166, excess_as_change=True)

Expand All @@ -26,10 +31,20 @@ def test_splice(node_factory, bitcoind):
assert len(list(mempool.keys())) == 1
assert result['txid'] in list(mempool.keys())

bitcoind.generate_block(6, wait_for_mempool=1)
bitcoind.generate_block(9, wait_for_mempool=1)

l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')
l1.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')

inv = l2.rpc.invoice(10**2, '3', 'no_3')
l1.rpc.pay(inv['bolt11'])

peer_channels = l1.rpc.listpeerchannels()['channels']
assert len(peer_channels) > 0

new_scid = peer_channels[0].get('short_channel_id')

assert new_scid != original_scid
all_channels = l1.rpc.listchannels()['channels']
print("ALL CHANNELS: {}".format(all_channels))
assert len(all_channels) > 0
Loading