plugin: Add a status field to htlcs in listpeers

Annotating the htlc in `listpeers` with their current status, and
which plugin is currently holding on to them with their
`htlc_accepted` hook can help us debug where plugins may go wrong.

Changelog-Added: jsonrpc: HTLCs in `listpeers` are now annotated with a status if they are waiting on an `htlc_accepted` hook of a plugin.
This commit is contained in:
Christian Decker
2021-06-02 18:04:01 +02:00
committed by Rusty Russell
parent a503032bab
commit 610d8a0a74
3 changed files with 16 additions and 1 deletions

View File

@@ -1059,6 +1059,13 @@ def test_htlc_accepted_hook_direct_restart(node_factory, executor):
f1 = executor.submit(l1.rpc.pay, i1)
l2.daemon.wait_for_log(r'Holding onto an incoming htlc for 10 seconds')
# Check that the status mentions the HTLC being held
l2.rpc.listpeers()
peers = l2.rpc.listpeers()['peers']
htlc_status = peers[0]['channels'][0]['htlcs'][0].get('status', None)
assert htlc_status == "Waiting for the htlc_accepted hook of plugin hold_htlcs.py"
needle = l2.daemon.logsearch_start
l2.restart()