lightningd: add delforward command.

Changelog-Added: JSON-RPC: `delforward` command to delete listforwards entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-09-19 10:22:58 +09:30
committed by Christian Decker
parent 7420a7021f
commit 3079afb024
11 changed files with 193 additions and 0 deletions

View File

@@ -2493,6 +2493,17 @@ def test_listforwards_and_listhtlcs(node_factory, bitcoind):
# But forwards are not forgotten!
assert l2.rpc.listforwards()['forwards'] == all_forwards
# Now try delforward!
with pytest.raises(RpcError, match="Could not find that forward") as exc_info:
l2.rpc.delforward(in_channel=c12, in_htlc_id=3, status='settled')
# static const errcode_t DELFORWARD_NOT_FOUND = 1401;
assert exc_info.value.error['code'] == 1401
l2.rpc.delforward(in_channel=c12, in_htlc_id=0, status='settled')
l2.rpc.delforward(in_channel=c12, in_htlc_id=1, status='settled')
l2.rpc.delforward(in_channel=c12, in_htlc_id=2, status='local_failed')
assert l2.rpc.listforwards() == {'forwards': []}
@pytest.mark.openchannel('v1')
def test_version_reexec(node_factory, bitcoind):