core-lightning/doc/schemas/lightning-listhtlcs.json
Rusty Russell b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
Without this, we have hardly any enforcement.  This is why the schema
mistake fixed in the previous patches weren't spotted immediately.

The hard work was done by:

```
$ for f in lightning-*.json; do grep -v '^  "additionalProperties": false,' $f | bagto $f; done
$ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done
$ make fmt-schemas
```

Then checking where 'additionalProperties: true' had been turned to
false (we deliberately use it in some places where there are if
statements in the schema, or occasionally where there can be arbitrary
fields).

[Including doc/rpc-schema-draft.json update by Shahana]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30

352 lines
11 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "listhtlcs",
"title": "Command for querying HTLCs",
"description": [
"The **listhtlcs** RPC command gets all HTLCs (which, generally, we remember for as long as a channel is open, even if they've completed long ago)."
],
"categories": [
"readonly"
],
"request": {
"required": [],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": [
"A short channel id (e.g. 1x2x3) or full 64-byte hex channel id, it will only list htlcs for that channel (which must be known)."
]
}
}
},
"response": {
"required": [
"htlcs"
],
"additionalProperties": false,
"properties": {
"htlcs": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"short_channel_id",
"id",
"expiry",
"direction",
"amount_msat",
"payment_hash",
"state"
],
"properties": {
"short_channel_id": {
"type": "short_channel_id",
"description": [
"The channel that contains/contained the HTLC."
]
},
"id": {
"type": "u64",
"description": [
"The unique, incrementing HTLC id the creator gave this."
]
},
"expiry": {
"type": "u32",
"description": [
"The block number where this HTLC expires/expired."
]
},
"amount_msat": {
"type": "msat",
"description": [
"The value of the HTLC."
]
},
"direction": {
"type": "string",
"enum": [
"out",
"in"
],
"description": [
"Out if we offered this to the peer, in if they offered it."
]
},
"payment_hash": {
"type": "hash",
"description": [
"Payment hash sought by HTLC."
]
},
"state": {
"type": "string",
"enum": [
"SENT_ADD_HTLC",
"SENT_ADD_COMMIT",
"RCVD_ADD_REVOCATION",
"RCVD_ADD_ACK_COMMIT",
"SENT_ADD_ACK_REVOCATION",
"RCVD_REMOVE_HTLC",
"RCVD_REMOVE_COMMIT",
"SENT_REMOVE_REVOCATION",
"SENT_REMOVE_ACK_COMMIT",
"RCVD_REMOVE_ACK_REVOCATION",
"RCVD_ADD_HTLC",
"RCVD_ADD_COMMIT",
"SENT_ADD_REVOCATION",
"SENT_ADD_ACK_COMMIT",
"RCVD_ADD_ACK_REVOCATION",
"SENT_REMOVE_HTLC",
"SENT_REMOVE_COMMIT",
"RCVD_REMOVE_REVOCATION",
"RCVD_REMOVE_ACK_COMMIT",
"SENT_REMOVE_ACK_REVOCATION"
],
"description": [
"The first 10 states are for `in`, the next 10 are for `out`."
]
}
}
}
}
}
},
"author": [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
],
"see_also": [
"lightning-listforwards(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:listhtlcs#1",
"method": "listhtlcs",
"params": [
"109x1x1"
]
},
"response": {
"htlcs": [
{
"short_channel_id": "109x1x1",
"id": 0,
"expiry": 126,
"direction": "out",
"amount_msat": 500000000,
"payment_hash": "684b5650b3deb052c93efe1fe16e7703b56272468eecdeb3daac5b81216dcb52",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 1,
"expiry": 136,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "d598cfc62da16b381b8fb8af9833a24005f730e54cc32c317fecc511ffc6d2a2",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 2,
"expiry": 149,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "80ff407792947a23f193f9a1968e9a437b071364ae3159f83631335c9a453c1b",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 3,
"expiry": 155,
"direction": "out",
"amount_msat": 10000202,
"payment_hash": "3b80a3028343b16f8ab7261343eae40ff73ba833b0b7d4dcbfd42a3078dc322b",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 4,
"expiry": 152,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "0458c01fdd3aa0b9829002390301f92083e78dc27bb293bc3e7caee5d4ed7259",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 5,
"expiry": 149,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "0458c01fdd3aa0b9829002390301f92083e78dc27bb293bc3e7caee5d4ed7259",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 6,
"expiry": 132,
"direction": "out",
"amount_msat": 50001,
"payment_hash": "788aea729ede48d315a199ce5ded76169601a61dd52e9734e707eb7c52e4e79e",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 7,
"expiry": 142,
"direction": "out",
"amount_msat": 1002,
"payment_hash": "e445ebcf339db3cba6184330ccc6e4a41e0bb38d237b93c1d2f71958d5a74e13",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 8,
"expiry": 137,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "968c136c07c39b17d1925358dd36f5dd86f8691c666ec27f24de5a84d590dc49",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 0,
"expiry": 136,
"direction": "in",
"amount_msat": 1000000,
"payment_hash": "a003badd6ad30f05f56e3607fd538456b05b9aad6135a494dad5320010af5844",
"state": "SENT_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 9,
"expiry": 136,
"direction": "out",
"amount_msat": 400000,
"payment_hash": "781dc1aee5839bf106f264b0a06cf0740f2c71fc51c9562e90f4ee38ca0fc459",
"state": "RCVD_REMOVE_ACK_REVOCATION"
}
]
}
},
{
"request": {
"id": "example:listhtlcs#2",
"method": "listhtlcs",
"params": {}
},
"response": {
"htlcs": [
{
"short_channel_id": "109x1x1",
"id": 0,
"expiry": 126,
"direction": "out",
"amount_msat": 500000000,
"payment_hash": "684b5650b3deb052c93efe1fe16e7703b56272468eecdeb3daac5b81216dcb52",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 1,
"expiry": 136,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "d598cfc62da16b381b8fb8af9833a24005f730e54cc32c317fecc511ffc6d2a2",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 2,
"expiry": 149,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "80ff407792947a23f193f9a1968e9a437b071364ae3159f83631335c9a453c1b",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 3,
"expiry": 155,
"direction": "out",
"amount_msat": 10000202,
"payment_hash": "3b80a3028343b16f8ab7261343eae40ff73ba833b0b7d4dcbfd42a3078dc322b",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 4,
"expiry": 152,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "0458c01fdd3aa0b9829002390301f92083e78dc27bb293bc3e7caee5d4ed7259",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 5,
"expiry": 149,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "0458c01fdd3aa0b9829002390301f92083e78dc27bb293bc3e7caee5d4ed7259",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 6,
"expiry": 132,
"direction": "out",
"amount_msat": 50001,
"payment_hash": "788aea729ede48d315a199ce5ded76169601a61dd52e9734e707eb7c52e4e79e",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 7,
"expiry": 142,
"direction": "out",
"amount_msat": 1002,
"payment_hash": "e445ebcf339db3cba6184330ccc6e4a41e0bb38d237b93c1d2f71958d5a74e13",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 8,
"expiry": 137,
"direction": "out",
"amount_msat": 10001,
"payment_hash": "968c136c07c39b17d1925358dd36f5dd86f8691c666ec27f24de5a84d590dc49",
"state": "RCVD_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 0,
"expiry": 136,
"direction": "in",
"amount_msat": 1000000,
"payment_hash": "a003badd6ad30f05f56e3607fd538456b05b9aad6135a494dad5320010af5844",
"state": "SENT_REMOVE_ACK_REVOCATION"
},
{
"short_channel_id": "109x1x1",
"id": 9,
"expiry": 136,
"direction": "out",
"amount_msat": 400000,
"payment_hash": "781dc1aee5839bf106f264b0a06cf0740f2c71fc51c9562e90f4ee38ca0fc459",
"state": "RCVD_REMOVE_ACK_REVOCATION"
}
]
}
}
]
}