Commit Graph

12590 Commits

Author SHA1 Message Date
Rusty Russell 9e93826eea gossipd: neaten node_has_broadcastable_channels logic.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-15 14:19:42 -06:00
Rusty Russell 73e50b26f9 devtools: fix ZOMBIE detection in devtools/dump-gossipstore.
A victim of simultaneous changes, and I didn't pick it up :(
    
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-15 14:19:42 -06:00
Adi Shankara 0110026190 Change year to 2023 in LICENSE
Changelog-None
2023-02-15 06:52:18 -06:00
Vincenzo Palazzo a104380e49 fix: fixes `FATAL SIGNAL 11` on gossmap node
This will fix a crash that I caused on armv7
and by looking inside the coredump with gdb
(by adding an assert on n that must be
different from null) I get the following stacktrace

```
(gdb) bt
\#0  0x00000000 in ?? ()
\#1  0x0043a038 in send_backtrace (why=0xbe9e3600 "FATAL SIGNAL 11") at common/daemon.c:36
\#2  0x0043a0ec in crashdump (sig=11) at common/daemon.c:46
\#3  <signal handler called>
\#4  0x00406d04 in node_announcement (map=0x938ecc, nann_off=495146) at common/gossmap.c:586
\#5  0x00406fec in map_catchup (map=0x938ecc, num_rejected=0xbe9e3a40) at common/gossmap.c:643
\#6  0x004073a4 in load_gossip_store (map=0x938ecc, num_rejected=0xbe9e3a40) at common/gossmap.c:697
\#7  0x00408244 in gossmap_load (ctx=0x0, filename=0x4e16b8 "gossip_store", num_channel_updates_rejected=0xbe9e3a40) at common/gossmap.c:976
\#8  0x0041a548 in init (p=0x93831c, buf=0x9399d4 "\n\n{\"jsonrpc\":\"2.0\",\"id\":\"cln:init#25\",\"method\":\"init\",\"params\":{\"options\":{},\"configuration\":{\"lightning-dir\":\"/home/vincent/.lightning/testnet\",\"rpc-file\":\"lightning-rpc\",\"startup\":true,\"network\":\"te"..., config=0x939cdc) at plugins/topology.c:622
\#9  0x0041e5d0 in handle_init (cmd=0x938934, buf=0x9399d4 "\n\n{\"jsonrpc\":\"2.0\",\"id\":\"cln:init#25\",\"method\":\"init\",\"params\":{\"options\":{},\"configuration\":{\"lightning-dir\":\"/home/vincent/.lightning/testnet\",\"rpc-file\":\"lightning-rpc\",\"startup\":true,\"network\":\"te"..., params=0x939c8c)
    at plugins/libplugin.c:1208
\#10 0x0041fc04 in ld_command_handle (plugin=0x93831c, toks=0x939bec) at plugins/libplugin.c:1572
\#11 0x00420050 in ld_read_json_one (plugin=0x93831c) at plugins/libplugin.c:1667
\#12 0x004201bc in ld_read_json (conn=0x9391c4, plugin=0x93831c) at plugins/libplugin.c:1687
\#13 0x004cb82c in next_plan (conn=0x9391c4, plan=0x9391d8) at ccan/ccan/io/io.c:59
\#14 0x004cc67c in do_plan (conn=0x9391c4, plan=0x9391d8, idle_on_epipe=false) at ccan/ccan/io/io.c:407
\#15 0x004cc6dc in io_ready (conn=0x9391c4, pollflags=1) at ccan/ccan/io/io.c:417
\#16 0x004cf8cc in io_loop (timers=0x9383c4, expired=0xbe9e3ce4) at ccan/ccan/io/poll.c:453
\#17 0x00420af4 in plugin_main (argv=0xbe9e3eb4, init=0x41a46c <init>, restartability=PLUGIN_STATIC, init_rpc=true, features=0x0, commands=0x6167e8 <commands>, num_commands=4, notif_subs=0x0, num_notif_subs=0, hook_subs=0x0, num_hook_subs=0, notif_topics=0x0, num_notif_topics=0) at plugins/libplugin.c:1891
\#18 0x0041a6f8 in main (argc=1, argv=0xbe9e3eb4) at plugins/topology.c:679
```

I do not know if this is a solution because I do not know
when I can parse a node announcement for a node that
it is not longer in the gossip map.

So, I hope this is just usefult for @rustyrussell

Changelog-Fixed: fixes `FATAL SIGNAL 11` on gossmap node announcement parsing.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13 17:51:41 -06:00
Michael Schmoock eea4781606 pytest: allow ipv6 in test_announce_dns_suppressed
The test runs fine on CI but can fail locally on IPv6 systems,
as the address descriptor is just checked agains IPv4.

Changelog-None
2023-02-13 16:33:25 -06:00
Alex Myers 2c7ceb8a21 peer storage: advertise features as optional
Fixes: #6002

Changelog-None
2023-02-14 06:21:44 +10:30
Alex Myers 1800139dbe meta: Add changelog for 23.02rc2
Changelog-None
2023-02-12 07:56:49 -06:00
Michael Schmoock 698eb0408f pytest: adds xfail test that shows datastore issues
When doing some plugin related work, I discovered that the datastore API
has two issues:

- Error messages on startup of plugins init method when the datastore is
  still completely empty: "Parsing '{datastore:[0:': token has no index 0: []"
- Data is escaped but not unwrapped again when sending and getting from
  the API.

[ Removed xfail, it now passes! --RR ]
Closes: #5990
2023-02-11 12:22:40 -06:00
Rusty Russell 9a77a995a8 lightningd: unescape JSON strings for db.
We were feeding in the raw JSON, which escapes \".  Then we were
escaping *again* to return it.

Reported-by: @m-schmook
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `datastore` handles escapes in `string` parameter correctly.
2023-02-11 12:22:40 -06:00
Rusty Russell 15a744be8c commando: don't try putting an integer as the 'string' parameter to "datastore".
This only worked because we handled the JSON raw: next patch prohibits this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-11 12:22:40 -06:00
Rusty Russell 70aee52903 libplugin: don't spew datastore errors to LOG_DEBUG.
People get upset, especially as our "not found" error can be a bit
hard to read!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
See-also: #5990
2023-02-11 12:22:40 -06:00
Vincenzo Palazzo dd9400df99 fix: compilation error on armv7l 32 bit
This fixes the following compilation error
and allow rebuilding again on 32-bit platform.

```
lightningd/dual_open_control.c: In function 'validate_input_unspent':
lightningd/dual_open_control.c:2627:43: error: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
 2627 |                         err = tal_fmt(pv, "PSBT input at index %"PRIu64
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~
 2628 |                                       " missing serial id", i);
      |                                                             ~
      |                                                             |
      |                                                             size_t {aka unsigned int}
ccan/ccan/tal/str/str.h:43:46: note: in definition of macro 'tal_fmt'
   43 |         tal_fmt_(ctx, TAL_LABEL(char, "[]"), __VA_ARGS__)
      |                                              ^~~~~~~~~~~

```

PS: apparently I'm the only remaining people that ran cln on an old raspberry pi 2?

Changelog-None
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-10 16:26:06 -06:00
Alex Myers 822db6acc2 gossipd: don't resurrect deleted half_chans
fixes #5989

Changelog-None
2023-02-10 16:15:30 -06:00
Vincenzo Palazzo a610f28ad4 add a log message when it is not possible upgrade the db
People are upgrading to 22.11.1 not, and in some configurations like the one
mentioned in the issue, we should
put some info information in the log when we are not able to upgrade.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-09 17:40:58 -06:00
Alex Myers b6a7532625 meta: Add changelog for 23.02rc1
Changelog-None
2023-02-08 23:11:42 -06:00
Carl Dong b83a19164c msggen: Regenerate for addition of SendCustomMsg
Performed using:
  PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
2023-02-08 23:10:53 -06:00
Carl Dong ef51ae3c6d msggen: Enable SendCustomMsg 2023-02-08 23:10:53 -06:00
Rusty Russell 49b3459be5 lightningd: don't put old deprecated `local_msat` and `remote_msat` in listpeerchannels.
These were deprecated in v0.12.0, hence scheduled for removal next version anyway
(use local_fund_msat and remote_funds_msat).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 21:17:37 -06:00
Vincenzo Palazzo b7ab80963d ci: include rust tests inside the pre build checks
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-08 16:33:26 -06:00
Vincenzo Palazzo 473c631ceb fix(grpc): add the num_channels field inside the tests
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-08 16:33:26 -06:00
Vincenzo Palazzo ca1fa84458 ignore sql binary plugin
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-08 14:38:58 -06:00
Riccardo Casatta 510abb934c cln-grpc: add roundtrip tests for test_getinfo and test_listppers 2023-02-08 12:03:27 -06:00
Riccardo Casatta 913f9da5a8 cln-rpc: explicitly enumerate ChannelState enum 2023-02-08 12:03:27 -06:00
Riccardo Casatta 21a8342289 Implement GRPC -> JSON conversions also for response types 2023-02-08 12:03:27 -06:00
Riccardo Casatta 9c35f9c13a Implement conversion JSON->GRPC also for requests type
This could be useful for existing software with  a JSON interface that want
to mimic the interface
2023-02-08 12:03:27 -06:00
Rusty Russell a71bd3ea37 options: create enable/disable option for peer storage.
Since it's not spec-final yet (hell, it's not even properly specified
yet!) we need to put it behind an experimental flag.

Unfortunately, we don't have support for doing this in a plugin; a
plugin must present features before parsing options.  So we need to do
it in core.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
Rusty Russell c60ea5bcbb plugins/chanbackup: make get_file_data take ctx.
When you return an allocated pointer, you should always hand in the
context you want it allocated from.  This is more explicit, because it may
really matter to the caller!

This also folds some simple operations, and avoids doing too much
variable assignment in the declarations themselves: some coding styles
prohibit such initializers, but that's a bit exteme.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
Rusty Russell 17c35819d8 plugins/chanbackup: neaten a little.
node_id can be on the stack, avoiding a tal call.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
Rusty Russell f1fed40ac2 features: make name of peer storage features match spec.
And we should always represent them as is, not as optional: it's
possible in future we could *require* "WANT_PEER_BACKUP_STORAGE".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
Rusty Russell 68d9b21aec plugins/chanbackup: switch to normal indentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
adi2011 fc382dd87e tests/test_misc.py: Add test_restorefrompeer. 2023-02-08 08:37:59 -06:00
adi2011 e637e843e7 Plugins/chanbackup: Add RPC for recovering from the latestscb received from peers. 2023-02-08 08:37:59 -06:00
adi2011 7affaff728 Plugins/chanbackup: Add hook for exchanging msgs on connect with a peer 2023-02-08 08:37:59 -06:00
adi2011 d205f489bd Plugins/chanbackup: Add hook for receiving custommsg 2023-02-08 08:37:59 -06:00
adi2011 01cafe478b Plugins/chanbackup: Add SCB on CHANNELD_AWAITING_LOCKING stage 2023-02-08 08:37:59 -06:00
adi2011 33f0c4ec0b plugins/chanbackup: use grab_file. 2023-02-08 08:37:59 -06:00
adi2011 ff777e3238 plugins/chanbackup: Define FILENAME globally (Good Manners) 2023-02-08 08:37:59 -06:00
adi2011 2b1867aca3 Plugins/chanbackup: Add featurebit Peerstrg and YourPeerStrg. 2023-02-08 08:37:59 -06:00
adi2011 93d03bf9e8 plugins/chanbackup: PLUGIN_RESTARTABLE to PLUGIN_STATIC... 2023-02-08 08:37:59 -06:00
adi2011 709ff01fd2 connectd: make exception for peer storage msgs. 2023-02-08 08:37:59 -06:00
adi2011 66d98c327f peer_wire_is_internal helper.
We are now going to have messages which we know about, but yet we
don't handle ourselves.

[ I reversed this from Adi's, as that was clearer! --RR ]
2023-02-08 08:37:59 -06:00
adi2011 5ef49143e0 feature(PEER_STORAGE and YOUR_PEER_STORAGE) added in feature.c and internal message. 2023-02-08 08:37:59 -06:00
adi2011 5f481aaf96 wire: Add patch file for peer storage bkp
Add msg type peer_storage and your_peer_storage
2023-02-08 08:37:59 -06:00
Rusty Russell d7bcac2ae7 lightningd: allow sendcustommsg even if plugins are still processing peer_connected.
This is needed for the next patch, which does this from the peer_connected hook!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `sendcustommsg` can now be called by a plugin from within the `peer_connected` hook.
2023-02-08 08:37:59 -06:00
Rusty Russell c0b898e860 lightningd: don't access peer after free if it disconnects during peer_connected hook.
We keep the node_id, not a pointer to the peer.

This also means that it might have reconnected while we were in the hook, so make
sure we ignore the result if it's in state PEER_CONNECTED.

And remove the `tal_steal(peer, hook_payload)` which doesn't do anything: the
plugin_hook call steals hook_payload anyway!

Fixes: #5944
2023-02-08 08:37:59 -06:00
Rusty Russell d6b553cfa0 lightningd: fix leak report from peer_connected.
`their_features` is allocated off the hook_payload.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-08 08:37:59 -06:00
niftynei 35d02a784b df: remove static remote key dependency
Must be negotiated independently.

Requested-By: @t-bast
2023-02-08 15:04:27 +10:30
niftynei 911700ff94 df: remove minimum witness weight for input calculations
We can't know how much taproot etc inputs weight will be, so we just
make sure that a peer covers the known bytes, at least.
2023-02-08 15:04:27 +10:30
niftynei c0cc285a0f df: fetch both the first+second commitment point
Ignore the sent back second commitment point that we get; we'll get it
again at `channel_ready`.
2023-02-08 15:04:27 +10:30
niftynei f465032f6f rfc-dual-fund: update to latest spec for dual-funding
- Renamed zerod_channel_ids to temporary_channel_id
- Renamed witness_stack->witnesses
- Renamed witness_element->witness_elements
- open_channel2 now includes second commitment point
- accept_channel2 now includes second commitment point

Current commit on rfc branch 64f7f360b9f3c2664d078e2129cfe83098fc4617

Changelog-EXPERIMENTAL: Protocol: dual-funding spec changed in incompatible ways, won't work with old versions (but maybe soon with Eclair!!)
2023-02-08 15:04:27 +10:30