Skip to content

Commit

Permalink
pytest: state_change history
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schmoock committed Oct 22, 2020
1 parent 262ec68 commit 6ecc5eb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,30 @@ def wait_for_event(node):
assert(event1['message'] == "Onchain init reply")


def test_channel_state_change_history(node_factory, bitcoind):
""" We open and close a channel and check for state_canges entries.
"""
l1, l2 = node_factory.line_graph(2)
scid = l1.get_channel_scid(l2)

l1.rpc.close(scid)
bitcoind.generate_block(100) # so it gets settled
bitcoind.generate_block(100) # so it gets settled

history = l1.rpc.listpeers()['peers'][0]['channels'][0]['state_changes']
assert(history[0]['cause'] == "USER")
assert(history[0]['old_state'] == "CHANNELD_AWAITING_LOCKIN")
assert(history[0]['new_state'] == "CHANNELD_NORMAL")
assert(history[1]['cause'] == "USER")
assert(history[1]['new_state'] == "CHANNELD_SHUTTING_DOWN")
assert(history[2]['cause'] == "USER")
assert(history[2]['new_state'] == "CLOSINGD_SIGEXCHANGE")
assert(history[3]['cause'] == "USER")
assert(history[3]['new_state'] == "CLOSINGD_COMPLETE")
assert(history[3]['message'] == "Closing complete")


@unittest.skipIf(not DEVELOPER, "without DEVELOPER=1, gossip v slow")
def test_htlc_accepted_hook_fail(node_factory):
"""Send payments from l1 to l2, but l2 just declines everything.
Expand Down

0 comments on commit 6ecc5eb

Please sign in to comment.