pytest: Add debugging to test_gossip_store_compact_on_load
This flake has been difficult to reproduce, so let's dump the gossip store to aid in debugging. See issue #5410. Changelog-None
tools: add md2man.sh tool, using lowdown.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Makefile: replace mrkd with lowdown(1).
Here's the before-vs-after comparison (ignoring whitespace changes):
```diff
--- /tmp/before 2022-07-20 21:52:44.336641810 +0930
+++ /tmp/after 2022-07-20 21:55:54.355487769 +0930
@@ -1,7 +1,7 @@
-LIGHTNING-CLI(1) lightning-cli LIGHTNING-CLI(1)
+LIGHTNING-CLI(1) LIGHTNING-CLI(1)
NAME
- lightning-cli - Control lightning daemon
+ lightning-cli -- Control lightning daemon
SYNOPSIS
lightning-cli [OPTIONS] command
@@ -14,10 +14,7 @@
--conf=PATH Sets configuration file (default: lightning-dir/config ).
- --network=network
- --mainnet
- --testnet
- --signet Sets network explicitly.
+ --network=network --mainnet --testnet --signet Sets network explicitly.
--rpc-file=FILE Named pipe to use to talk to lightning daemon: default is lightning-rpc in the lightning directory.
@@ -43,8 +40,8 @@
--version/-V Print version number to standard output and exit.
- allow-deprecated-apis=BOOL Enable deprecated options. It defaults to true, but you should set it to false when testing
- to ensure that an upgrade won't break your configuration.
+ allow-deprecated-apis=BOOL Enable deprecated options. It defaults to true, but you should set it to false when testing to
+ ensure that an upgrade won't break your configuration.
COMMANDS
lightning-cli simply uses the JSON RPC interface to talk to lightningd, and prints the results. Thus the commands avail‐
@@ -67,7 +64,7 @@
lightning-cli help
- 1. Fund a 10k sat channel using uncomfirmed outputs
+ 2. Fund a 10k sat channel using uncomfirmed outputs
lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0
@@ -84,4 +81,4 @@
Note: the modules in the ccan/ directory have their own licenses, but the rest of the code is covered by the BSD-style
MIT license.
- LIGHTNING-CLI(1)
+Core Lightning v0.11.0.1-350-gac2e137 LIGHTNING-CLI(1)
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: #5437doc: format markdown correctly.
There are no definition lists in Markdown, and lists get mangled if
they follow immediately: they need a line between them.
So use bullets for options, and use an indent so the text gets in the
line below.
Here's a before-and-after example:
```diff
--- /tmp/after 2022-07-20 21:55:54.355487769 +0930
+++ /tmp/after2 2022-07-20 21:58:17.305642576 +0930
@@ -10,38 +10,71 @@
lightning-cli sends commands to the lightning daemon.
OPTIONS
- --lightning-dir=DIR Set the directory for the lightning daemon we're talking to; defaults to $HOME/.lightning.
+ • --lightning-dir=DIR
- --conf=PATH Sets configuration file (default: lightning-dir/config ).
+ Set the directory for the lightning daemon we're talking to; defaults to $HOME/.lightning.
- --network=network --mainnet --testnet --signet Sets network explicitly.
+ • --conf=PATH
- --rpc-file=FILE Named pipe to use to talk to lightning daemon: default is lightning-rpc in the lightning directory.
+ Sets configuration file (default: lightning-dir/config ).
- --keywords/-k Use format key=value for parameters in any order
+ • --network=network
- --order/-o Follow strictly the order of parameters for the command
+ • --mainnet
- --json/-J Return result in JSON format (default unless help command, or result contains a format-hint field).
+ • --testnet
- --raw/-R Return raw JSON directly as lightningd replies; this can be faster for large requests.
+ • --signet
- --human-readable/-H Return result in human-readable output.
+ Sets network explicitly.
- --flat/-F Return JSON result in flattened one-per-line output, e.g. { "help": [ { "command": "check" } ] } would become
+ • --rpc-file=FILE
+
+ Named pipe to use to talk to lightning daemon: default is lightning-rpc in the lightning directory.
+
+ • --keywords/-k
+
+ Use format key=value for parameters in any order
+
+ • --order/-o
+
+ Follow strictly the order of parameters for the command
+
+ • --json/-J
+
+ Return result in JSON format (default unless help command, or result contains a format-hint field).
+
+ • --raw/-R
+
+ Return raw JSON directly as lightningd replies; this can be faster for large requests.
+
+ • --human-readable/-H
+
+ Return result in human-readable output.
+
+ • --flat/-F
+
+ Return JSON result in flattened one-per-line output, e.g. { "help": [ { "command": "check" } ] } would become
help[0].command=check. This is useful for simple scripts which want to find a specific output field without parsing
JSON.
- --notifications/-N=LEVEL If LEVEL is 'none', then never print out notifications. Otherwise, print out notifications of
- LEVEL or above (one of io, debug, info (the default), unusual or broken: they are prefixed with # .
+ • --notifications/-N=LEVEL
+
+ If LEVEL is 'none', then never print out notifications. Otherwise, print out notifications of LEVEL or above (one of
+ io, debug, info (the default), unusual or broken: they are prefixed with # .
+
+ • --help/-h
+
+ Pretty-print summary of options to standard output and exit. The format can be changed using -F, -R, -J, -H etc.
+
+ • --version/-V
- --help/-h Pretty-print summary of options to standard output and exit. The format can be changed using -F, -R, -J, -H
- etc.
+ Print version number to standard output and exit.
- --version/-V Print version number to standard output and exit.
+ • allow-deprecated-apis=BOOL
- allow-deprecated-apis=BOOL Enable deprecated options. It defaults to true, but you should set it to false when testing to
- ensure that an upgrade won't break your configuration.
+ Enable deprecated options. It defaults to true, but you should set it to false when testing to ensure that an upgrade
+ won't break your configuration.
COMMANDS
lightning-cli simply uses the JSON RPC interface to talk to lightningd, and prints the results. Thus the commands avail‐
@@ -60,13 +93,13 @@
this is not encouraged.
EXAMPLES
- 1. List commands
+ 1. List commands:
- lightning-cli help
+ • lightning-cli help
- 2. Fund a 10k sat channel using uncomfirmed outputs
+ 2. Fund a 10k sat channel using uncomfirmed outputs:
- lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0
+ • lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0
BUGS
This manpage documents how it should work, not how it does work. The pretty printing of results isn't pretty.
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>doc: generate correct markdown from schemas.
You can't start a list without a paragraph separator.
```diff
--- /tmp/before 2022-07-20 22:02:23.485372596 +0930
+++ /tmp/after 2022-07-20 22:02:33.745528456 +0930
@@ -21,12 +21,16 @@
On startup of the daemon, no autoclean is set up.
RETURN VALUE
- On success, an object is returned, containing: - enabled (boolean):
- whether invoice autocleaning is active
+ On success, an object is returned, containing:
- If enabled is true: - expired_by (u64): how long an invoice must be ex‐
- pired (seconds) before we delete it - cycle_seconds (u64): how long an
- invoice must be expired (seconds) before we delete it
+ • enabled (boolean): whether invoice autocleaning is active
+
+ If enabled is true:
+
+ • expired_by (u64): how long an invoice must be expired (seconds) be‐
+ fore we delete it
+ • cycle_seconds (u64): how long an invoice must be expired (seconds)
+ before we delete it
AUTHOR
ZmnSCPxj <ZmnSCPxj@protonmail.com> is mainly responsible.
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>Makefile: Revert ba7d4a8 (make-schema: don't include tools/fromschema…
….py in SHASUMS) 1. If the tool changes, you need to regenerate since the output may change. 2. This didn't just filter that out, ignored all but the first dependency, which made bisecting the bookkeeper plugin a nightmare: it didn't regenerate the .po file, causing random crashes. If we want this, try $(filter-out tools/fromschema.py) instead. But I don't think we want that. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
doc: always escape underscores in property names
If there's only a single underscore, lowdown ignores it, but if there are multiple (see min_final_cltv_expiry) it decides we're trying to highlight part of the word. Reported-by: @wtogami Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
external/lowdown: local import of lowdown source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
external: build lowdown if not already found.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
doc: document that we can build lowdown, remove from Alpine.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
connectd: better diagnostics on invalid gossip_store entries.
Should help diagnose #5572 which hit the invalid csum on a >64MB entry, if it happens again. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Requires us to update to latest lnproto which is now using the most up to date python-bitcoinlib, as well as updating our python lock files (which pin the grpcio deps, because of locking problems h/t @cdecker)
builds: cleanup duplicate and unused code, fix spelling
Few extremely minor updates to the ubuntu dockerfile and ci builds
bkpr: failing test for bookkeeper crash
Reproduce crash for #5557! If we record the channel open because bookkeeper was added after the channel open request started but the channel confirms later, we end up with re-recording any associated push or leased fees (paid or rcvd). In the case where you've paid for these fees, your channel balance goes negative and the node crashes the next time you call `listbalances`. Reported-by: @chrisguida
notif: dont send balance snapshot for not yet opened channel
We were double counting channel lease fees because we were double firing the channel open event sequence (so to speak). If we don't report balances for unopened channels, we don't have this problem? Changelog-Changed: Plugins: `balance_snapshot` notification does not send balances for channels that aren't locked-in/opened yet
bkpr: migration to delete any duplicate lease_fee entries
Clean up for #5557. If you've got duplicate 'lease_fee' entries, we delete them!
bkpr: confirm that replaying the open+lock-in txs at start is ok
Make sure that we're not issuing duplicate lease_fee events!
bkpr-test: maybe fix race in test_bookkeeping_closing_trimmed_htlcs
test_bookkeeping_closing_trimmed_htlcs fails to find 'all outputs resolved' occassionally, seems like it's because the OUR_DELAYED_TO_WALLET doesn't make it into the mempool before we start mining blocks? So here make sure there's something in the mempool before before we start making new blocks.
gossip_store: fix offset error
The gossip_store version byte was unaccounted for in the initial traversal of gossip_store_end. This lead to an offset and a bogus message length field. As a result, an early portion of the gossip_store could have been skipped, potentially leading to gossip propagation issues downstream. Fixes #5572 #5565 Changelog-fixed: proper gossip_store operation may resolve some previous gossip propagation issues
gossmap: don't crash if we see a duplicate channel_announce.
Apparently we had two private channel announcements (the !private assert failed). While this shouldn't happen, don't crash because of it. Fixes: #5578 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: Plugins: topology plugin could crash when it sees duplicate private channel announcements.
connectd+: Flake/race fix for new channels
1) dualopen has fd to connectd 2) channeld needs to take over 3) dualopen passes fd that leads to a connectd over for channeld to use 4) lightningd must receive the fd transfer request and process 5) dualopen shuts down and closes everything it owns 4 & 5 end up in a race. If 5 happens before 4, channeld ends up with an invalid fd for connectd — leaving it in a position to not receive messages. Lingering for a second makes 4 win the race. Since the daemon is closing anyway, waiting for a second should be alright. Changelog-Fixed: Fixed a condition for newly created channels that could trigger a need for reconnect.
peer_control: fix getinfo showing unannounced addr
Currently discovered IPs are only announced when we don't have any usable addresses detected or configured already. However, the cli command `getinfo` still showed theses unannounced addr as if they were announced. Changelog-Fixed: peer_control: getinfo showing unannounced addresses.
cleanup: fix mixed indentation of json_getinfo
This one got badly messed up over time. I know we usually don't fix these to have easier git-bisect. I can remove this commit if required.
peer_control: getinfo show correct port on discovered IPs
Changelog-Fixed: peer_control: getinfo shows the correct port on discovered IPs
build-release: configure before submodcheck
We added a submod dep (lowdown) that requires config to run first.
contrib/pyln-client: allow lightningd to give us non-numeric ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
libplugin: forget pending requests if associated command freed.
This is usually fine, but without this, commando (another branch!) has a race: 1. A command has multiple parts. 2. We start sending them out. 3. We get a response, which completes the cmd. 4. We go to send the next one out, but it's been freed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
libplugin: handle JSON reply after command freed.
This can happen, and in fact does below in our test_autoclean_once test where we update the datastore, and return from the cmd. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>