doc: Add GENERATE_EXAMPLES env

- Run with environment variable `GENERATE_EXAMPLES`
- Update cln version in getinfo example on `make update-versions`
- Added two `dev` configs, dev-no-plugin-checksum and dev-no-version-checks, to match CI listconfigs
- Changed commando rpc example from `getinfo` to `newaddr` to avoid unneccessary file updates for future builds
- Stabilized `bkpr-editdescriptionbyoutpoint`, `listclosedchannels` and `listaddresses` examples
This commit is contained in:
ShahanaFarooqui 2024-11-26 11:01:26 -08:00 committed by Rusty Russell
parent 075f180596
commit a3a33fe3be
9 changed files with 74 additions and 287 deletions

View file

@ -3301,7 +3301,7 @@
"currency": "bcrt",
"outpoint": "txidbk0101010101010101010101010101010101010101010101010101010101:1",
"timestamp": 1738510000,
"blockheight": 105,
"blockheight": 110,
"description": "edited utxo description"
}
]
@ -6343,38 +6343,15 @@
"method": "commando",
"params": {
"peer_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
"rune": "_RWaZZRI7wAYU2hqlFBmYgC_dFczcpAdI_9O87YbDpg9MCZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5Jm1ldGhvZC9saXN0ZGF0YXN0b3Jl",
"method": "getinfo",
"params": {}
"rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==",
"method": "newaddr",
"params": {
"addresstype": "p2tr"
}
}
},
"response": {
"id": "nodeid020202020202020202020202020202020202020202020202020202020202",
"alias": "SILENTARTIST",
"color": "022d22",
"num_peers": 3,
"num_pending_channels": 0,
"num_active_channels": 3,
"num_inactive_channels": 1,
"address": [],
"binding": [
{
"type": "ipv4",
"address": "127.0.0.1",
"port": 19735
}
],
"version": "v24.11rc1",
"blockheight": 130,
"network": "regtest",
"fees_collected_msat": 106,
"lightning-dir": "/tmp/.lightning/regtest",
"our_features": {
"init": "08a0882a8a59a1",
"node": "88a0882a8a59a1",
"channel": "",
"invoice": "02000002024100"
}
"p2tr": "bcrt1p338x07070707070707070707070707070707070707070707070707070707"
}
},
{
@ -17062,14 +17039,14 @@
"id": "example:listaddresses#1",
"method": "listaddresses",
"params": [
"bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
]
},
"response": {
"addresses": [
{
"keyidx": 13,
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"keyidx": 14,
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
]
}
@ -17095,97 +17072,6 @@
}
]
}
},
{
"request": {
"id": "example:listaddresses#3",
"method": "listaddresses",
"params": {}
},
"response": {
"addresses": [
{
"keyidx": 1,
"bech32": "bcrt1qyusnugshkn6kh5vmdjpe8hylvxlxjy3ns0hmrs"
},
{
"keyidx": 2,
"p2tr": "bcrt1pmeuewfgl24n06v9868kts5v92494zexrvg0hc0sdmgwwnxm6t9sqdwfqjx"
},
{
"keyidx": 3,
"bech32": "bcrt1qv8ksdsrr9tegfmy7ryhfwav0cprf9jpfqdfr4m"
},
{
"keyidx": 4,
"p2tr": "bcrt1p3femk2q5x0ettk65v8r80z4z4lfguqgau67sg7v6txgkvtrp675qyc4gu2"
},
{
"keyidx": 5,
"p2tr": "bcrt1pshtjqf083lgghds3r8cfs74sqs04q4s6mfhpxrry2dpahrzyc2hslyvm7n"
},
{
"keyidx": 6,
"bech32": "bcrt1qkpw662yvzdy5ttdg8nw4eh4el0uc7m2ythw0h3"
},
{
"keyidx": 7,
"p2tr": "bcrt1pn45xgkyj54usdu98plm4zgcp4c5jvvfxmyexwcm5kc3gyfsrjmasd6ctsf"
},
{
"keyidx": 8,
"p2tr": "bcrt1pxu96ugcrazch0y4rfmsy4k5x56etsn7hdgq3gwatmzvu0mv7sdeql5x9qe"
},
{
"keyidx": 9,
"bech32": "bcrt1q5czetq5cqrxsnxqx0wkm85v8eup7yvjy3vlnr7"
},
{
"keyidx": 10,
"p2tr": "bcrt1plk4hcq06uuxq3c93lxk2ejs3pff3y8n4m322yhn4gfqk7dp2atmsj2vr99"
},
{
"keyidx": 11,
"p2tr": "bcrt1pvn0zt2s8cv6shrtx8yd0zh90hwx4wpuqjrplfzpucnmde7kr4q3qx3fjfh"
},
{
"keyidx": 12,
"bech32": "bcrt1qcqqvkswps3e6ck3jmqf86f9tcaeke5z04d3tv4"
},
{
"keyidx": 13,
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
},
{
"keyidx": 14,
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
},
{
"keyidx": 15,
"p2tr": "bcrt1p9dwaqcfmdef574edhn6rzxmxumxghvr79pvj3hdklfterern0p6qx77a44"
},
{
"keyidx": 16,
"bech32": "bcrt1qswadp7rqx7m0zx2tffhzmqfansdrpfesr2la7k"
},
{
"keyidx": 17,
"p2tr": "bcrt1pqr02nvastyzya4q3lcjd00l56xemhhgf59srfgyk5jchtal44s8sjt683e"
},
{
"keyidx": 18,
"bech32": "bcrt1qnk3lx7dch2ygmd8447wr7rj2yu0y92zl9wqf60"
},
{
"keyidx": 19,
"p2tr": "bcrt1pnsdhwv72k277x6uzajv6ld84tmfu6env4ajy8amprpk8pjfn9n9s3fjvxv"
},
{
"keyidx": 20,
"p2tr": "bcrt1p9n7h55ahdhmhlakvusfh8xlq98j9780punc9dx84xafcr8xulxmqwn4aa9"
}
]
}
}
]
},
@ -17833,8 +17719,8 @@
"channel_id": "channelid0230000230000230000230000230000230000230000230000230000",
"short_channel_id": "111x1x1",
"alias": {
"local": "9100000x13000000x63000",
"remote": "3500000x7300000x11000"
"local": "121x131x141",
"remote": "151x161x171"
},
"opener": "local",
"closer": "local",
@ -17860,7 +17746,7 @@
"min_to_us_msat": 489809898,
"max_to_us_msat": 1000000000,
"last_commitment_txid": "txidcloselastcommitment00000100001000010000100001000010000100001",
"last_commitment_fee_msat": 2896000,
"last_commitment_fee_msat": 2895000,
"close_cause": "user",
"last_stable_connection": 1738500000
},
@ -17869,8 +17755,8 @@
"channel_id": "channelid0250000250000250000250000250000250000250000250000250000",
"short_channel_id": "115x1x1",
"alias": {
"local": "6500000x1100000x23000",
"remote": "5300000x1300000x55000"
"local": "122x132x142",
"remote": "152x162x172"
},
"opener": "local",
"closer": "local",
@ -17896,7 +17782,7 @@
"min_to_us_msat": 500000000,
"max_to_us_msat": 1000000000,
"last_commitment_txid": "txidcloselastcommitment00000200002000020000200002000020000200002",
"last_commitment_fee_msat": 2895000,
"last_commitment_fee_msat": 2896000,
"close_cause": "user",
"last_stable_connection": 1738500000
}
@ -20602,6 +20488,14 @@
"source": "default",
"plugin": "/root/lightning/plugins/offers"
},
"dev-no-plugin-checksum": {
"set": true,
"source": "cmdline"
},
"dev-no-version-checks": {
"set": true,
"source": "cmdline"
},
"developer": {
"set": true,
"source": "cmdline"
@ -27415,7 +27309,7 @@
"bcrt1qm7k64cvd2ljw758ptwrrm8ny30u67ea3cfkxpn": 1000
},
{
"bcrt1qswadp7rqx7m0zx2tffhzmqfansdrpfesr2la7k": 1000
"bcrt1qdgvytwcw58uwlf3lqrej2eqaku6smn2mdvkycp": 1000
},
{
"bcrt1q68wfpfam8tu3a457jv7u8r64tdvqltgfs0kj84": 1000
@ -27511,7 +27405,7 @@
"params": {}
},
"response": {
"bech32": "bcrt1qcqqvkswps3e6ck3jmqf86f9tcaeke5z04d3tv4"
"bech32": "bcrt1qwx6am26cuw38y4863pd6swrce2g8mzhaxr9xp8"
}
},
{
@ -27523,7 +27417,7 @@
}
},
"response": {
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
}
]

View file

@ -286,7 +286,7 @@
"currency": "bcrt",
"outpoint": "txidbk0101010101010101010101010101010101010101010101010101010101:1",
"timestamp": 1738510000,
"blockheight": 105,
"blockheight": 110,
"description": "edited utxo description"
}
]

View file

@ -91,38 +91,15 @@
"method": "commando",
"params": {
"peer_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
"rune": "_RWaZZRI7wAYU2hqlFBmYgC_dFczcpAdI_9O87YbDpg9MCZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5Jm1ldGhvZC9saXN0ZGF0YXN0b3Jl",
"method": "getinfo",
"params": {}
"rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==",
"method": "newaddr",
"params": {
"addresstype": "p2tr"
}
}
},
"response": {
"id": "nodeid020202020202020202020202020202020202020202020202020202020202",
"alias": "SILENTARTIST",
"color": "022d22",
"num_peers": 3,
"num_pending_channels": 0,
"num_active_channels": 3,
"num_inactive_channels": 1,
"address": [],
"binding": [
{
"type": "ipv4",
"address": "127.0.0.1",
"port": 19735
}
],
"version": "v24.11rc1",
"blockheight": 130,
"network": "regtest",
"fees_collected_msat": 106,
"lightning-dir": "/tmp/.lightning/regtest",
"our_features": {
"init": "08a0882a8a59a1",
"node": "88a0882a8a59a1",
"channel": "",
"invoice": "02000002024100"
}
"p2tr": "bcrt1p338x07070707070707070707070707070707070707070707070707070707"
}
},
{

View file

@ -90,14 +90,14 @@
"id": "example:listaddresses#1",
"method": "listaddresses",
"params": [
"bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
]
},
"response": {
"addresses": [
{
"keyidx": 13,
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"keyidx": 14,
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
]
}
@ -123,97 +123,6 @@
}
]
}
},
{
"request": {
"id": "example:listaddresses#3",
"method": "listaddresses",
"params": {}
},
"response": {
"addresses": [
{
"keyidx": 1,
"bech32": "bcrt1qyusnugshkn6kh5vmdjpe8hylvxlxjy3ns0hmrs"
},
{
"keyidx": 2,
"p2tr": "bcrt1pmeuewfgl24n06v9868kts5v92494zexrvg0hc0sdmgwwnxm6t9sqdwfqjx"
},
{
"keyidx": 3,
"bech32": "bcrt1qv8ksdsrr9tegfmy7ryhfwav0cprf9jpfqdfr4m"
},
{
"keyidx": 4,
"p2tr": "bcrt1p3femk2q5x0ettk65v8r80z4z4lfguqgau67sg7v6txgkvtrp675qyc4gu2"
},
{
"keyidx": 5,
"p2tr": "bcrt1pshtjqf083lgghds3r8cfs74sqs04q4s6mfhpxrry2dpahrzyc2hslyvm7n"
},
{
"keyidx": 6,
"bech32": "bcrt1qkpw662yvzdy5ttdg8nw4eh4el0uc7m2ythw0h3"
},
{
"keyidx": 7,
"p2tr": "bcrt1pn45xgkyj54usdu98plm4zgcp4c5jvvfxmyexwcm5kc3gyfsrjmasd6ctsf"
},
{
"keyidx": 8,
"p2tr": "bcrt1pxu96ugcrazch0y4rfmsy4k5x56etsn7hdgq3gwatmzvu0mv7sdeql5x9qe"
},
{
"keyidx": 9,
"bech32": "bcrt1q5czetq5cqrxsnxqx0wkm85v8eup7yvjy3vlnr7"
},
{
"keyidx": 10,
"p2tr": "bcrt1plk4hcq06uuxq3c93lxk2ejs3pff3y8n4m322yhn4gfqk7dp2atmsj2vr99"
},
{
"keyidx": 11,
"p2tr": "bcrt1pvn0zt2s8cv6shrtx8yd0zh90hwx4wpuqjrplfzpucnmde7kr4q3qx3fjfh"
},
{
"keyidx": 12,
"bech32": "bcrt1qcqqvkswps3e6ck3jmqf86f9tcaeke5z04d3tv4"
},
{
"keyidx": 13,
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
},
{
"keyidx": 14,
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
},
{
"keyidx": 15,
"p2tr": "bcrt1p9dwaqcfmdef574edhn6rzxmxumxghvr79pvj3hdklfterern0p6qx77a44"
},
{
"keyidx": 16,
"bech32": "bcrt1qswadp7rqx7m0zx2tffhzmqfansdrpfesr2la7k"
},
{
"keyidx": 17,
"p2tr": "bcrt1pqr02nvastyzya4q3lcjd00l56xemhhgf59srfgyk5jchtal44s8sjt683e"
},
{
"keyidx": 18,
"bech32": "bcrt1qnk3lx7dch2ygmd8447wr7rj2yu0y92zl9wqf60"
},
{
"keyidx": 19,
"p2tr": "bcrt1pnsdhwv72k277x6uzajv6ld84tmfu6env4ajy8amprpk8pjfn9n9s3fjvxv"
},
{
"keyidx": 20,
"p2tr": "bcrt1p9n7h55ahdhmhlakvusfh8xlq98j9780punc9dx84xafcr8xulxmqwn4aa9"
}
]
}
}
]
}

View file

@ -302,8 +302,8 @@
"channel_id": "channelid0230000230000230000230000230000230000230000230000230000",
"short_channel_id": "111x1x1",
"alias": {
"local": "9100000x13000000x63000",
"remote": "3500000x7300000x11000"
"local": "121x131x141",
"remote": "151x161x171"
},
"opener": "local",
"closer": "local",
@ -329,7 +329,7 @@
"min_to_us_msat": 489809898,
"max_to_us_msat": 1000000000,
"last_commitment_txid": "txidcloselastcommitment00000100001000010000100001000010000100001",
"last_commitment_fee_msat": 2896000,
"last_commitment_fee_msat": 2895000,
"close_cause": "user",
"last_stable_connection": 1738500000
},
@ -338,8 +338,8 @@
"channel_id": "channelid0250000250000250000250000250000250000250000250000250000",
"short_channel_id": "115x1x1",
"alias": {
"local": "6500000x1100000x23000",
"remote": "5300000x1300000x55000"
"local": "122x132x142",
"remote": "152x162x172"
},
"opener": "local",
"closer": "local",
@ -365,7 +365,7 @@
"min_to_us_msat": 500000000,
"max_to_us_msat": 1000000000,
"last_commitment_txid": "txidcloselastcommitment00000200002000020000200002000020000200002",
"last_commitment_fee_msat": 2895000,
"last_commitment_fee_msat": 2896000,
"close_cause": "user",
"last_stable_connection": 1738500000
}

View file

@ -2695,6 +2695,14 @@
"source": "default",
"plugin": "/root/lightning/plugins/offers"
},
"dev-no-plugin-checksum": {
"set": true,
"source": "cmdline"
},
"dev-no-version-checks": {
"set": true,
"source": "cmdline"
},
"developer": {
"set": true,
"source": "cmdline"

View file

@ -121,7 +121,7 @@
"bcrt1qm7k64cvd2ljw758ptwrrm8ny30u67ea3cfkxpn": 1000
},
{
"bcrt1qswadp7rqx7m0zx2tffhzmqfansdrpfesr2la7k": 1000
"bcrt1qdgvytwcw58uwlf3lqrej2eqaku6smn2mdvkycp": 1000
},
{
"bcrt1q68wfpfam8tu3a457jv7u8r64tdvqltgfs0kj84": 1000

View file

@ -70,7 +70,7 @@
"params": {}
},
"response": {
"bech32": "bcrt1qcqqvkswps3e6ck3jmqf86f9tcaeke5z04d3tv4"
"bech32": "bcrt1qwx6am26cuw38y4863pd6swrce2g8mzhaxr9xp8"
}
},
{
@ -82,7 +82,7 @@
}
},
"response": {
"p2tr": "bcrt1phtprcvhz842sxe8qw0yryvc0g6n6dw2puweklcpnfye273kjpfhs0d6d2e"
"p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
}
}
]

View file

@ -8,6 +8,7 @@
from fixtures import * # noqa: F401,F403
from fixtures import TEST_NETWORK
from pyln.client import RpcError, Millisatoshi # type: ignore
from pyln.testing.utils import GENERATE_EXAMPLES
from utils import only_one, mine_funding_to_announce, sync_blockheight, wait_for, first_scid, serialize_payload_tlv, serialize_payload_final_tlv
import sys
import os
@ -21,7 +22,10 @@ import ast
import subprocess
CWD = os.getcwd()
GENERATE_EXAMPLES = True
CLN_VERSION = 'v'
with open(os.path.join('.version'), 'r') as f:
CLN_VERSION = CLN_VERSION + f.read().strip()
FUND_WALLET_AMOUNT_SAT = 200000000
FUND_CHANNEL_AMOUNT_SAT = 10**6
REGENERATING_RPCS = []
@ -45,10 +49,6 @@ NEW_VALUES_LIST = {
'hsm_secret_cdx_1': 'cl10leetsd35kw6r5de5kueedxyesqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqluplcg0lxenqd',
'error_message_1': 'All addresses failed: 127.0.0.1:19736: Cryptographic handshake: peer closed connection (wrong key?). ',
'configs_3_addr2': "127.0.0.1:19735",
'closed_channel_alias_local_1': '9100000x13000000x63000',
'closed_channel_alias_remote_1': '3500000x7300000x11000',
'closed_channel_alias_local_2': '6500000x1100000x23000',
'closed_channel_alias_remote_2': '5300000x1300000x55000',
'bitcoin-rpcport': 18332,
'grpc-port': 9736,
'blockheight_110': 110,
@ -77,6 +77,7 @@ NEW_VALUES_LIST = {
'destination_4': 'bcrt1p00' + ('02' * 28),
'destination_5': 'bcrt1p00' + ('03' * 28),
'destination_6': 'bcrt1p00' + ('04' * 28),
'destination_7': 'bcrt1p338x' + ('07' * 28),
'funding_serial_1': 17725655605188010000,
'funding_serial_2': 17725655605188020000,
'funding_serial_3': 17725655605188030000,
@ -155,8 +156,6 @@ NEW_VALUES_LIST = {
'utxo_1': 'utxo' + ('01' * 30),
'ocs_txid_1': 'txidocsigned10' + ('11000' * 10),
'ocs_txid_2': 'txidocsigned10' + ('12000' * 10),
'close_lc_txid_1': 'txidcloselastcommitment0' + ('00001' * 8),
'close_lc_txid_2': 'txidcloselastcommitment0' + ('00002' * 8),
'c12_channel_id': 'channelid0' + ('120000' * 9),
'c23_channel_id': 'channelid0' + ('230000' * 9),
'c23_2_channel_id': 'channelid0' + ('230200' * 9),
@ -293,6 +292,7 @@ REPLACE_RESPONSE_VALUES = [
{'data_keys': ['outnum', 'funding_outnum', 'vout'], 'original_value': 0, 'new_value': NEW_VALUES_LIST['num_1']},
{'data_keys': ['outnum', 'funding_outnum', 'vout'], 'original_value': 2, 'new_value': NEW_VALUES_LIST['num_1']},
{'data_keys': ['outnum', 'funding_outnum', 'vout'], 'original_value': 3, 'new_value': NEW_VALUES_LIST['num_1']},
{'data_keys': ['type'], 'original_value': 'unilateral', 'new_value': 'mutual'},
]
if os.path.exists(LOG_FILE):
@ -454,6 +454,8 @@ def setup_test_nodes(node_factory, bitcoind):
'experimental-dual-fund': None,
'may_reconnect': True,
'dev-hsmd-no-preapprove-check': None,
'dev-no-plugin-checksum': None,
'dev-no-version-checks': None,
'allow-deprecated-apis': True,
'allow_bad_gossip': True,
'broken_log': '.*',
@ -506,7 +508,7 @@ def setup_test_nodes(node_factory, bitcoind):
{'data_keys': ['alias'], 'original_value': l2.info['alias'], 'new_value': NEW_VALUES_LIST['l2_alias']},
{'data_keys': ['port'], 'original_value': l2.info['binding'][0]['port'], 'new_value': NEW_VALUES_LIST['l2_port']},
{'data_keys': ['netaddr'], 'original_value': [f'127.0.0.1:{l2.info["binding"][0]["port"]}'], 'new_value': [NEW_VALUES_LIST['l2_addr']]},
{'data_keys': ['version'], 'original_value': l2.info['version'], 'new_value': l2.info['version'].split('-')[0]},
{'data_keys': ['version'], 'original_value': getinfo_res2['version'], 'new_value': CLN_VERSION},
{'data_keys': ['blockheight'], 'original_value': getinfo_res2['blockheight'], 'new_value': NEW_VALUES_LIST['blockheight_110']},
{'data_keys': ['alias'], 'original_value': l3.info['alias'], 'new_value': NEW_VALUES_LIST['l3_alias']},
{'data_keys': ['port'], 'original_value': l3.info['binding'][0]['port'], 'new_value': NEW_VALUES_LIST['l3_port']},
@ -772,7 +774,7 @@ def generate_runes_examples(l1, l2, l3):
update_example(node=l2, method='createrune', params=[rune_l25['rune'], [['time<"$(($(date +%s) + 24*60*60))"', 'rate=2']]], description=["Before we give this to our peer, let's add two more restrictions: that it only be usable for 24 hours from now (`time<`), and that it can only be used twice a minute (`rate=2`). `date +%s` can give us the current time in seconds:"])
update_example(node=l2, method='commando-listrunes', params={'rune': rune_l23['rune']})
update_example(node=l2, method='commando-listrunes', params={})
commando_res1 = update_example(node=l1, method='commando', params={'peer_id': l2.info['id'], 'rune': rune_l22['rune'], 'method': 'getinfo', 'params': {}})
commando_res1 = update_example(node=l1, method='commando', params={'peer_id': l2.info['id'], 'rune': rune_l21['rune'], 'method': 'newaddr', 'params': {'addresstype': 'p2tr'}})
update_example(node=l1, method='commando', params={'peer_id': l2.info['id'], 'rune': rune_l23['rune'], 'method': 'listpeers', 'params': [l3.info['id']]})
inv_l23 = l2.rpc.invoice('any', 'lbl_l23', 'l23 description')
commando_res3 = update_example(node=l1, method='commando', params={'peer_id': l2.info['id'], 'rune': rune_l24['rune'], 'method': 'pay', 'params': {'bolt11': inv_l23['bolt11'], 'amount_msat': 9900}})
@ -807,7 +809,7 @@ def generate_runes_examples(l1, l2, l3):
{'data_keys': ['last_used'], 'original_value': showrunes_res2['runes'][1]['last_used'], 'new_value': NEW_VALUES_LIST['time_at_800']},
{'data_keys': ['last_used'], 'original_value': showrunes_res2['runes'][2]['last_used'], 'new_value': NEW_VALUES_LIST['time_at_800']},
{'data_keys': ['any', 'bolt11'], 'original_value': inv_l23['bolt11'], 'new_value': NEW_VALUES_LIST['bolt11_l23']},
{'data_keys': ['blockheight'], 'original_value': commando_res1['blockheight'], 'new_value': NEW_VALUES_LIST['blockheight_130']},
{'data_keys': ['p2tr'], 'original_value': commando_res1['p2tr'], 'new_value': NEW_VALUES_LIST['destination_7']},
{'data_keys': ['created_at'], 'original_value': commando_res3['created_at'], 'new_value': NEW_VALUES_LIST['time_at_800']},
{'data_keys': ['payment_hash'], 'original_value': commando_res3['payment_hash'], 'new_value': NEW_VALUES_LIST['payment_hash_cmd_pay_1']},
{'data_keys': ['payment_preimage'], 'original_value': commando_res3['payment_preimage'], 'new_value': NEW_VALUES_LIST['payment_preimage_cmd_1']},
@ -873,7 +875,7 @@ def generate_bookkeeper_examples(l2, l3, c23_2_chan_id):
update_example(node=l3, method='bkpr-editdescriptionbypaymentid', params={'payment_id': invoice['payment_id'], 'description': 'edited invoice description from description send some sats l2 to l3'})
# Try to edit a payment_id that does not exist
update_example(node=l3, method='bkpr-editdescriptionbypaymentid', params={'payment_id': 'c000' + ('01' * 30), 'description': 'edited invoice description for non existing payment id'})
update_example(node=l3, method='bkpr-editdescriptionbyoutpoint', params={'outpoint': utxo_event['outpoint'], 'description': 'edited utxo description'})
editdescriptionbyoutpoint_res1 = update_example(node=l3, method='bkpr-editdescriptionbyoutpoint', params={'outpoint': utxo_event['outpoint'], 'description': 'edited utxo description'})
# Try to edit an outpoint that does not exist
update_example(node=l3, method='bkpr-editdescriptionbyoutpoint', params={'outpoint': 'abcd' + ('02' * 30) + ':1', 'description': 'edited utxo description for non existing outpoint'})
@ -972,6 +974,7 @@ def generate_bookkeeper_examples(l2, l3, c23_2_chan_id):
{'data_keys': ['fees_paid_msat'], 'original_value': bkprinspect_res1['txs'][0]['fees_paid_msat'], 'new_value': NEW_VALUES_LIST['fees_paid_msat_1']},
{'data_keys': ['timestamp'], 'original_value': bkprlistaccountevents_res1['events'][0]['timestamp'], 'new_value': NEW_VALUES_LIST['time_at_850']},
{'data_keys': ['outpoint'], 'original_value': bkprlistaccountevents_res1['events'][0]['outpoint'], 'new_value': 'txidbk' + ('01' * 29) + ':1'},
{'data_keys': ['blockheight'], 'original_value': editdescriptionbyoutpoint_res1['updated'][0]['blockheight'], 'new_value': NEW_VALUES_LIST['blockheight_110']},
])
logger.info('Bookkeeper Done!')
except Exception as e:
@ -1920,6 +1923,11 @@ def generate_list_examples(l1, l2, l3, c12, c23_2, inv_l31, inv_l32, offer_l23,
update_example(node=l1, method='listtransactions', params={}, response=listtransactions_res1)
listclosedchannels_res1 = l2.rpc.listclosedchannels()
listclosedchannels_res1 = update_list_responses(listclosedchannels_res1, list_key='closedchannels')
for i, closedchannel in enumerate(listclosedchannels_res1['closedchannels'], start=1):
closedchannel['last_commitment_fee_msat'] = 2894000 + (i * 1000)
closedchannel['last_commitment_txid'] = 'txidcloselastcommitment0' + (('0000' + str(i)) * 8)
closedchannel['last_stable_connection'] = NEW_VALUES_LIST['time_at_850']
closedchannel['alias'] = {'local': '12' + str(i) + 'x13' + str(i) + 'x14' + str(i), 'remote': '15' + str(i) + 'x16' + str(i) + 'x17' + str(i)}
update_example(node=l2, method='listclosedchannels', params={}, response=listclosedchannels_res1)
update_example(node=l2, method='listconfigs', params={'config': 'network'})
@ -2008,18 +2016,9 @@ def generate_list_examples(l1, l2, l3, c12, c23_2, inv_l31, inv_l32, offer_l23,
update_example(node=l2, method='listinvoicerequests', params={}, response=listinvoicerequests_res2)
update_example(node=l2, method='listaddresses', params=[address_l22['p2tr']])
update_example(node=l2, method='listaddresses', params={'start': 6, 'limit': 2})
update_example(node=l2, method='listaddresses', params={})
REPLACE_RESPONSE_VALUES.extend([
{'data_keys': ['any', 'invreq_id'], 'original_value': inv_req_l1_l22['invreq_id'], 'new_value': NEW_VALUES_LIST['invreq_id_l1_l22']},
{'data_keys': ['netaddr'], 'original_value': listpeers_res2['peers'][0]['netaddr'], 'new_value': [NEW_VALUES_LIST['l1_addr']]},
{'data_keys': ['local'], 'original_value': listclosedchannels_res1['closedchannels'][0]['alias']['local'], 'new_value': NEW_VALUES_LIST['closed_channel_alias_local_1']},
{'data_keys': ['remote'], 'original_value': listclosedchannels_res1['closedchannels'][0]['alias']['remote'], 'new_value': NEW_VALUES_LIST['closed_channel_alias_remote_1']},
{'data_keys': ['local'], 'original_value': listclosedchannels_res1['closedchannels'][1]['alias']['local'], 'new_value': NEW_VALUES_LIST['closed_channel_alias_local_2']},
{'data_keys': ['remote'], 'original_value': listclosedchannels_res1['closedchannels'][1]['alias']['remote'], 'new_value': NEW_VALUES_LIST['closed_channel_alias_remote_2']},
{'data_keys': ['last_commitment_txid'], 'original_value': listclosedchannels_res1['closedchannels'][0]['last_commitment_txid'], 'new_value': NEW_VALUES_LIST['close_lc_txid_1']},
{'data_keys': ['last_stable_connection'], 'original_value': listclosedchannels_res1['closedchannels'][0]['last_stable_connection'], 'new_value': NEW_VALUES_LIST['time_at_850']},
{'data_keys': ['last_commitment_txid'], 'original_value': listclosedchannels_res1['closedchannels'][1]['last_commitment_txid'], 'new_value': NEW_VALUES_LIST['close_lc_txid_2']},
{'data_keys': ['last_stable_connection'], 'original_value': listclosedchannels_res1['closedchannels'][1]['last_stable_connection'], 'new_value': NEW_VALUES_LIST['time_at_850']},
{'data_keys': ['any'], 'original_value': listconfigs_res3['configs']['addr']['values_str'][0], 'new_value': NEW_VALUES_LIST['configs_3_addr2']},
{'data_keys': ['value_int'], 'original_value': listconfigs_res3['configs']['bitcoin-rpcport']['value_int'], 'new_value': NEW_VALUES_LIST['bitcoin-rpcport']},
{'data_keys': ['value_int'], 'original_value': listconfigs_res3['configs']['grpc-port']['value_int'], 'new_value': NEW_VALUES_LIST['grpc-port']},
@ -2032,7 +2031,7 @@ def generate_list_examples(l1, l2, l3, c12, c23_2, inv_l31, inv_l32, offer_l23,
raise
@unittest.skipIf(GENERATE_EXAMPLES is not True, 'Generates examples for doc/schema/lightning-*.json files.')
@unittest.skipIf(not GENERATE_EXAMPLES, 'Generates examples for doc/schema/lightning-*.json files.')
def test_generate_examples(node_factory, bitcoind, executor):
"""Re-generates examples for doc/schema/lightning-*.json files"""
try: