Commit Graph

12561 Commits

Author SHA1 Message Date
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
niftynei 3586559fac test (df): check 'require-confirmed-inputs' for v2 opens 2023-02-07 21:03:36 -06:00
niftynei beec517910 df: persist our setting to disk, read back to dualopend at reinit
It's not likely but possible that the node's settings will shift btw a
start and an RBF; we persist the setting to the database so we don't
lose it.

Right now holding onto it forever is kind of extra but maybe we'll
reuse the setting for splices? idk.

Should this be a channel type??
2023-02-07 21:03:36 -06:00
niftynei fa80f15f85 dualopend: if required, validate inputs rcvd from peer
Pass in the "validate inputs confirmed" flag from lightningd; use flag
to determine whether or not to validate the inputs we've recieved from
peer.
2023-02-07 21:03:36 -06:00
niftynei 442b479d2c df: add new config option for v2 opens `--require_confirmed_inputs`
If set, require peers to only provide confirmed inputs for any v2 open
(both in accepter + opener role)
2023-02-07 21:03:36 -06:00
niftynei abb50c4627 df: reuse psbt validation for the psbts incoming from dualopend
Add callback methods to extant psbt validator, and expand usage to
include the handling psbt validation requests from dualopend.
2023-02-07 21:03:36 -06:00
niftynei 0da2729ce6 df: for dryruns, inform on requires-confirmation value 2023-02-07 21:03:36 -06:00
niftynei cea7fe3f05 df: push back psbt to validate iff peer requests confirmed inputs
`openchannel_init` takes a psbt, which we pipe over to dualopend
process.

If the peer requests that they'll only accept confirmed inputs, we need
to go validate those before we continue.

This wires up the harness for this (validation check yet tc)
2023-02-07 21:03:36 -06:00
niftynei 9f53e3c7f5 df: wire up peer's "require-confirmed-inputs"
We push this info out to the various RPCs/hooks.
2023-02-07 21:03:36 -06:00
niftynei f05d450098 df: persist channel open preference to database
technically we don't need this info after the channel opens, but for any
subsequent RBF (and maybe splice?) we need to remember what the
open/accept peer signaled
2023-02-07 21:03:36 -06:00
niftynei 3eecbaee4d tx_roles: allow to be serialized btw processes
We're going to use this in a bit to pass role type btw
dualopend/lightningd
2023-02-07 21:03:36 -06:00
niftynei 739d3c7b47 v2 open: if flagged, check that all our inputs are confirmed
not amazing, since we'll probably call openchannel_update multiple
times per open, but this is the simplest way to confirm that we're
not sending unconfirmed outputs to peer.
2023-02-07 21:03:36 -06:00
Greg Sanders 813401b2a6 Update Bitcoin Core to 24.0.1 in other git ci locations 2023-02-07 16:29:00 -06:00
Greg Sanders b67fde8106 Fix 'extreme cases' logging of many commit timer failures 2023-02-07 15:08:13 -06:00
Michael Schmoock 1e951a9479 mssgen: adds num_channels 2023-02-07 14:46:04 -06:00
Michael Schmoock 30454ddf19 pytest: listpeers new attribute num_channels 2023-02-07 14:46:04 -06:00
Michael Schmoock e736c4d5f4 doc: listpeers new attribute num_channels 2023-02-07 14:46:04 -06:00
Michael Schmoock a418615b7f rpc: adds num_channels to listpeers
This will save a lot of RPC ping/pong when plugins still need to iterate
both, `listpeers` and `listpeerchannels`. When `num_channels` is 0 they
can skip additional calls.

Changelog-Added: RPC `listpeers` output now has `num_channels`.
2023-02-07 14:46:04 -06:00
Christian Decker e5d5737927 grpc: Allow conversion code to use deprecated fields
The warning was rather superfluous, we should rather annotate the
downstream structs so the developer gets a warning, not us library
maintainers.
2023-02-07 08:23:17 -06:00
Christian Decker 640edf3955 grpc: Silence a warning about `nonnumericids` being unused 2023-02-07 08:23:17 -06:00
Greg Sanders eef0c087fc More accurate elements commitment tx size estimation 2023-02-06 18:50:26 -06:00
Carl Dong dc4ae9deb4 msggen: Regenerate for addition of SignInvoice
Performed using:
  PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
2023-02-06 15:54:32 -06:00
Carl Dong 11227d37ba msggen: Enable SignInvoice 2023-02-06 15:54:32 -06:00
Carl Dong 1dbc29b8c0 lightningd: Add `signinvoice` to sign a BOLT11 invoice.
Though there's already a `createinvoice` command, there are usecases where a
user may want to sign an invoice that they don't yet have the preimage to. For
example, they may have an htlc_accepted plugin that pays to obtain the preimage
from someone else and returns a `{ "result": "resolve", ... }`.

This RPC command addresses this usecase without overly complicating the
semantics of the existing `createinvoice` command.

Changelog-Added: JSON-RPC: `signinvoice` new command to sign BOLT11
invoices.
2023-02-06 15:54:32 -06:00
Carl Dong f0b8544eba doc: Correct `createinvoice`'s `invstring` description
The existing description is incorrect. `createinvoice` doesn't actually
work when supplied with a custom-encoded bolt11 invoice without the
final 520 signature bits appended. If a users tries to do so, some of
their tagged fields will be incorrectly truncated.

`createinvoice` actually expects that the signatures are there, and it
simply ignores them.

See common/bolt11.c's bolt11_decode_nosig:

         /* BOLT #11:
          *
          * The data part of a Lightning invoice consists of multiple sections:
          *
          * 1. `timestamp`: seconds-since-1970 (35 bits, big-endian)
          * 1. zero or more tagged parts
          * 1. `signature`: Bitcoin-style signature of above (520 bits)
          */
         if (!pull_uint(&hu5, &data, &data_len, &b11->timestamp, 35))
                 return decode_fail(b11, fail, "Can't get 35-bit timestamp");

>        while (data_len > 520 / 5) {
                 const char *problem = NULL;
                 u64 type, data_length;
2023-02-06 15:54:32 -06:00
Vincenzo Palazzo 8369ca71b1 cli: accepts long paths as options
This allows to accept safely long paths as options
and does not truncate them
as https://github.com/ElementsProject/lightning/issues/5576
described

Changelog-Fixed: cli: accepts long paths as options

Suggested-by: @rustyrussell <rusty@rustcorp.com.au>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-07 06:38:36 +10:30
Christian Decker 59ed23e6cf make: Add doc/index.rst to generated files
It gets partially regenerated, so include it in the check. This is the
root cause for the v22.11-modded issue some have noticed.
2023-02-06 19:53:44 +01:00
Rusty Russell 7b9f1b72c6 lightningd: don't print zero blockheight while we're syncing.
In v0.11 (71f736678f) we changed lightningd to wait for gossipd to
acknowledge blocks before updating blockheight: this resolved a problem
which lnprototest had where it wanted to know when we'd fully digested
a block.

However, it broke the syncing case: until then we don't even tell
gossipd, so this stayed at zero.  We should use the current blockheight
for that corner case!

Fixes: #5894
Changelog-Fixed: JSON-RPC: `getinfo` `blockheight` no longer sits on 0 while we sync with bitcoind the first time.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-06 10:15:48 -06:00
Rusty Russell e29fd2a8e2 SECURITY.md: Tell them to spam me, and include our GPG fingerprints.
Added Alex since he's Release Captain this time.

Changelog-Added: SECURITY.md: Where to send sensitive bug reports, and dev GPG fingerprints.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-06 09:39:19 -06:00
Rusty Russell d06c1871a9 pytest: fix flake in test_closing_disconnected_notify
We might be disconnected, but the subd isn't dead yet:

```
>       assert out[0] == '# peer is offline, will negotiate once they reconnect (5 seconds before unilateral close).'
E       AssertionError: assert '# Timed out, forcing close.' == ('# peer is offline, will negotiate once they reconnect (5 seconds before '\n 'unilateral close).')
E         - # peer is offline, will negotiate once they reconnect (5 seconds before unilateral close).
E         + # Timed out, forcing close.

tests/test_closing.py:164: AssertionError
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-02-06 18:51:44 +10:30