Commit Graph

11866 Commits

Author SHA1 Message Date
Rusty Russell bcabb3825f Makefile: Revert ba7d4a8f6b (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>
2022-09-08 00:36:51 +03:00
Rusty Russell 8f1164365e 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>
2022-09-08 00:36:51 +03:00
Rusty Russell 3c3f4731bd doc: 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>
2022-09-08 00:36:51 +03:00
Rusty Russell 50056ce918 doc: remove mrkd requirement, add lowdown requirement.
I guessed it's called "lowdown" for everyone?

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-08 00:36:51 +03:00
Rusty Russell 2e48722f37 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: #5437
2022-09-08 00:36:51 +03:00
Rusty Russell 8e57bf3796 tools: add md2man.sh tool, using lowdown.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-08 00:36:51 +03:00
Rusty Russell dc56b2a9ac connectd: better diagnostics on invalid gossip_store entries.
Should help diagnose https://github.com/ElementsProject/lightning/issues/5572
which hit the invalid csum on a >64MB entry, if it happens again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-08 00:04:55 +03:00
Rusty Russell c4203e7de6 pyln-client: allow 'msat' fields to be 'null'
This happens with deprecated-apis and listconfigs, breaking some
python plugins!

Fixes: #5546
Fixes: #5563
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-07 11:01:36 +09:30
niftynei ea414320a3 build, shadows: fix broken build (no shadows)
Merged a commit that broke everything with shadows, which turned out to
be the bookkeeper code.
2022-08-31 21:40:41 +03:00
Matt Morehouse 0d5808b6f6 pytest: fix test_channel_state_change_history
The test fails because the closed channel is deleted by the time we
check the state change history.

It is unnecessary to mine any blocks after the close, since the state
changes up to CLOSINGD_COMPLETE occur without onchain changes.
2022-08-31 12:23:43 +03:00
Rusty Russell 2c72229106 configure: add -Wshadow=local flag.
This will warn us if there are local variables which shadow the
same-named variable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-31 12:18:28 +03:00
Rusty Russell 44d9e8d9c5 Remove names of parameters of callbacks which confuse gcc.
We annotate them with UNNEEDED, which is legal but weird, but it
makes gcc (at least 11.2.0) complain about shadowing:

	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106424

I simply removed the names.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-31 12:18:28 +03:00
Rusty Russell 6fe570820e Remove general shadowed variables.
We shadow local variables in several places: generally, these changes
make the code clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-31 12:18:28 +03:00
Rusty Russell 6a7d40f51a ccan: update to get -Wshadow=local clean build.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-31 12:18:28 +03:00
Igor Bubelov d4a04ba8b3 Simplify poetry interactions 2022-08-31 12:16:39 +03:00
Igor Bubelov 299a99ed67 Use unordered list 2022-08-31 12:16:39 +03:00
Igor Bubelov ba76854e29 Add Arch Linux build instructions 2022-08-31 12:16:39 +03:00
Igor Bubelov 397c880426 Add Arch Linux build instructions 2022-08-31 12:16:39 +03:00
Alex Myers 0abe2e3af1 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
2022-08-26 07:03:10 +09:30
niftynei 3ce26735e5 v0.12.0 release changelog 2022-08-23 14:13:25 -04:00
Orb fd8b667e6a use 'postgres' driver (not postgresql). Include plain url to guide, as link is broken on RTD. 2022-08-22 11:21:59 -04:00
greggzigler ce9232af37 Changelog-None 2022-08-22 11:21:19 -04:00
greggzigler c13dffe980 fix MD link where text and url are swapped 2022-08-22 11:21:19 -04:00
niftynei 8cdbe97d91 v0.12.0rc3 - Release Candidate numero tres
Release Candidate 3 for v0.12.0.

Now with more bugfixes!
2022-08-19 18:05:56 -04:00
Rusty Russell 7c9985fd9c channeld: correct reversed shutdown message in billboard.
It was backwards, which made #5496 confusing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `listpeers` `status` "They've sent shutdown" and "We've sent shutdown" were backwards.
2022-08-19 11:04:37 -04:00
Christian Decker aabf38a11d ci: Fix the Mac OS build test 2022-08-19 10:44:21 -04:00
adi2011 8f78a76d1a tests/test_misc.py: check logs for already existing channel. 2022-08-19 10:27:09 -04:00
adi2011 0b737fd7e5 doc: Typo 2022-08-19 10:27:09 -04:00
adi2011 23b675922f lightningd/opening_control.c: Skip over channels which are already stored, and don't create new peer if it already exits. Changelog-None 2022-08-19 10:27:09 -04:00
Rusty Russell 9219e778a1 doc: update usage of lightning-invoice.
The new parameter name (this version) is amount_msat: msatoshi is
deprecated.   The doc/schemas/invoice.request.json has this correct
(but we don't generate teh *usage* line from that yet!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-18 15:53:14 -04:00
Ken Sedgwick 82f7035524 Renumber hsmd_derive_secret for consistency with other hsmd messages 2022-08-16 15:04:49 -05:00
Christian Decker 65549a2931 ld: Fix a log message assuming that the `channel->scid` was set
This is no longer true after we introduce `zeroconf`, so use the alias
local alias instead if not set.

Signed-off-by: Christian Decker <@cdecker>
2022-08-16 14:52:52 -05:00
Christian Decker ab1ca7f159 pytest: Reproduce a crash when we have multiple channels and 0conf
This is a case where we assume that the `channel->scid` is set, which
is no longer true with `zeroconf`

Changelog-None: Zeroconf was not yet released at the time the discovery was made

Reported-by: Yaacov Akiba Slama <@yaslama>
Reported-by: Roei Erez <@roeierez>
2022-08-16 14:52:52 -05:00
niftynei 1a25651182 bkpr-recorder: fatal if there's an error with a database statement
We were silently failing when NULLS FIRST wasn't found on older boxes
(running sqlite3 < v3.30.1)
2022-08-16 12:32:08 -05:00
niftynei fdfca9e721 sqlite3: no NULLS FIRST
sqlite3 added NULLS FIRST to their schema as of v3.30.1 but some older
boxes aren't updated (notably the author's own node box).

The default behavior for sqlite3 is to sort nulls first however, this
is *really* only needed for postgres.

As a simple fix (which will allow older boxes to not upgrade their
sqlite yet), simply strip out the NULLS FIRST keywords from sqlite3
queries.

Reported-By: Simon Vrouwe @SimonVrouwe
Fixes: #5517
2022-08-16 12:32:08 -05:00
niftynei 4e7f89f211 signpsbt: don't crash if HSM doesn't like your psbt, just return err
Changelog-Changed: JSON-RPC: `signpsbt` no longer crashes if it doesn't like what your PSBT is
2022-08-13 12:57:03 -05:00
niftynei 4984014578 signpsbt: add utxo info to inputs
If you build a PSBT externally from CLN and attempt to sign for the
output, we would crash. Now we don't crash.

Changelog-Changed: JSON-RPC: `signpsbt` will now add redeemscript + witness-utxo to the PSBT for an input that we can sign for, before signing it.

Fixes #5499 ?
2022-08-13 12:57:03 -05:00
niftynei 63f8c74da9 psbt: dont crash when printing psbt to log
We call `tal_wally_start` and then `tal_wally_start` again in
`type_to_string` for psbt.

end the last tal before calling type to string.

Fixes: #5499
Reported-By: @fiatjaf

lightning_hsmd: FATAL SIGNAL 6 (version v0.11.0.1-231-gddf8fbd-modded)
0x5574ca0d87ef send_backtrace
	common/daemon.c:33
0x5574ca0d8877 crashdump
	common/daemon.c:46
0x7f76ef63e8df ???
	???:0
0x7f76ef68e36c ???
	???:0
0x7f76ef63e837 ???
	???:0
0x7f76ef628534 ???
	???:0
0x5574ca0df55e tal_wally_start
	common/utils.c:27
0x5574ca0e4024 psbt_to_b64
	bitcoin/psbt.c:687
0x5574ca0e4093 fmt_wally_psbt_
	bitcoin/psbt.c:694
0x5574ca0df4b9 type_to_string_
	common/type_to_string.c:32
0x5574ca0d5139 sign_our_inputs
	hsmd/libhsmd.c:486
0x5574ca0d5206 handle_sign_withdrawal_tx
	hsmd/libhsmd.c:1029
0x5574ca0d63c4 hsmd_handle_client_message
	hsmd/libhsmd.c:1575
0x5574ca0ce763 handle_client
	hsmd/hsmd.c:671
0x5574ca100032 next_plan
	ccan/ccan/io/io.c:59
0x5574ca1004b9 do_plan
	ccan/ccan/io/io.c:407
0x5574ca100552 io_ready
	ccan/ccan/io/io.c:417
0x5574ca101daf io_loop
	ccan/ccan/io/poll.c:453
0x5574ca0ceb7b main
	hsmd/hsmd.c:739
0x7f76ef62928f ???
	???:0
0x7f76ef629349 ???
	???:0
0x5574ca0cda04 ???
	../sysdeps/x86_64/start.S:115
2022-08-13 12:57:03 -05:00
niftynei 04cb6316d5 CHANGELOG: v0.12.0rc2 2022-08-10 18:48:41 -05:00
Ken Sedgwick 0878002fe6 Fix derived_secret, use correct size of secretstuff.derived secret
[ Updated tests to match -- RR]
2022-08-10 12:41:27 -05:00
Rusty Russell eb006dcadd wallet: fix incorrect column-width access.
Postgresql actually checks, and fails.

It's unclear why this field is an INTEGER (and u32) when it's a BIGINT 
in db here (it's an INTEGER in the channels table, just a BIGINT in the
channel_funding_inflights table).

Changelog-Fixed: db: postgresql crash on startup when dual-funding lease open is pending with "s32 field doesn't match size: expected 4, actual 8"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-10 10:34:12 -05:00
Rusty Russell b173b29346 pytest: test loading lease_chan_max_msat from channel_funding_inflights
It crashes with:

```
s32 field doesn't match size: expected 4, actual 8
```

Reported-by: @zerofeerouting
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-10 10:34:12 -05:00
niftynei 9d3bf4a1b5 bkpr: let channel reconnect, flake? 2022-08-10 10:30:45 -05:00
niftynei 72a30fc750 bkpr: dont flake, wait til pay done before mining blocks 2022-08-10 10:30:45 -05:00
niftynei 256044081f bkpr: remove duplicate log stmt 2022-08-10 10:30:45 -05:00
niftynei 23cd58402a bkpr: create accounts for zero sat channels
we weren't making records for 'missed' accounts that had a zero balance
at snapshot time (if peer opens channel and is unused)

Fixes: #5502
Reported-By: https://github.com/niftynei/cln-logmaid
2022-08-10 10:30:45 -05:00
Rusty Russell 1ff8e1bacb doc: note that setchannel maxhtlc/minhtlc only apply to *forwards*.
Reported-by: Warren Togami
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:38:57 -05:00
Rusty Russell fcba09dc33 doc: document that sendonion doesn't have to specify (but can!) the first_hop channel.
This was always the case, though it was ignored.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:33:24 -05:00
Rusty Russell 054339e0cb lightningd: obey first hop channel id.
Reported-by: Warren Togami
Changelog-Changed: `sendpay` and `sendonion` now obey the first hop "channel" short_channel_id, if specified.
Changelog-Deprecated: `sendpay` and `sendonion` could take a bogus first hop "channel" short_channel_id
2022-08-09 16:33:24 -05:00
Rusty Russell 9543204b79 pytest: don't use bogus scids for first hop of route.
This was a legacy from when it was redundant: with multiple channels, it
no longer is!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-08-09 16:33:24 -05:00