Commit Graph

13842 Commits

Author SHA1 Message Date
ShahanaFarooqui 90824a5d32 runes: Get next unique id from runes table 2023-10-03 08:56:53 +10:30
ShahanaFarooqui 9bcabbc912 runes: Reimplement `rate` in terms of `per`
Changelog-Changed: JSON-RPC: `checkrune` `rate` restriction is slightly stricter (exact division of time like `per`)
2023-10-03 06:57:54 +10:30
Rusty Russell d61dec8925 pytest: trim mostly-reundant commando-rune test.
We test this in test_runes, so make this test more cursory (otherwise
next patch breaks it).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-03 06:57:54 +10:30
ShahanaFarooqui b2fe1bc1e5 tools: Fixed release verify typo
Removed `bin-` while copying Fedora sums from release captain's file. Sums are saved as `clightning-$VERSION-Fedora-28-amd64.tar.gz` not as `clightning-$VERSION-bin-Fedora-28-amd64.tar.gz`

Changelog-None.
2023-10-02 15:18:00 +10:30
Rusty Russell 72f914a295 lightningd: simplify funding_depth_cb now it only handles main funding tx.
We make dualopend_tell_depth static, which means we move it
higher in the file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 79d04090fb lightningd: fix dual-funding case where we coop close and an RBF confirms.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 2f394653a8 lightningd: ensure we *always* watch channel spend.
Now we're not always using the same functions to watch during
dual-funding opening, we need to make sure we're watching the close
(in particular, df close before the opening is confirmed).

So, keep a pointer, and if it's not set in drop_to_chain, set it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 3ca753e0b4 lightningd: fix bug where we didn't correctly change outpoint of splice scid.
We used the original channel funding output number.  I'm not sure if this
was true in the previous code, or a regression I introduced, but it
caused occasonal failures in test_splice_gossip!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 854bda81ac lightningd: don't share funding_depth_cb for non-funding txs.
We use the *same* callback for the funding tx, as well as for inflight dual-funding txs, as well as inflight splice txs.  This is deeply confusing!

Instead, use explicit cbs for splicing and df.  Once they're locked in, use the normal callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 1cd53ae53e lightningd: fix watch on existing tx.
We never do this, but we're about to (we always watch before
we broadcast a tx).

We use a `depth` member to avoid calling the callback multiple times
for the same event, but we initialize it to 0.  This means if we
register a watch, and the first thing that happens is that it
reorganizes out, we *don't* make the callback.

Use an impossible value at initialization, instead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell eb1ef40f96 lightningd: make watch_txid more generic.
Don't assume the arg is a channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 4eb2f95e16 lightningd: remove watch_tx() in favor of watch_txid().
It was a wrapper only used in one place anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 5cf536d4b1 lightningd: make channel-query functions all take state.
It has the information we need, now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell acc30c0b3f lightningd: split DUALOPEND_OPEN_INIT into DUALOPEND_OPEN_INIT and DUALOPEND_OPEN_COMMITTED.
The latter is used when we're put in the db, the former is the uncommitted state.
Currently dbid == 0 is used in addition to the state, which is unwieldy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Experimental: JSON-RPC: added new dual-funding state `DUALOPEND_OPEN_COMMITTED`
2023-10-02 11:41:19 +10:30
Rusty Russell 5b9b056853 doc: introduce new state DUALOPEND_OPEN_COMMITTED.
This is the variant of DUALOPEND_OPEN_INIT which you see once
the channel is in the db: we'll be adding it next, but to reduce
clutter the docs are added as a separate commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 55285629d3 common/json_stream, lightningd/notification: clean up function APIs
We usually hand times by copy, not by pointer (and if we did, they should
be const!).  I noticed this particularly for the state changed code, but
it goes down to to json_add_timeiso, so I fixed that too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 3589cf6713 lightningd/channel.h: rename channel_unsaved to the more explicit channel_state_uncommitted.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell b228999e67 wallet: add standard sanity-check function for channel_state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 36bed08f90 lightningd: remove peer_any_unsaved_channel and use peer_any_channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 0b4622bcbd lightningd/channel.h: clean up channel states.
We should use capability tests for states (can you add htlcs?) rather than vague
descriptions (are you closing?).

And as much as possible, use switch () statements to force us to think
about all the cases, especially when we add new states!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 11ec03c6da lightningd: generalize peer_any_active_channel to peer_any_channel.
Take an optional filter function, so callers can say exactly what they want. 

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 2de7171286 lightningd: fold funding tx depth into a single function.
Currently it's half done in funding_depth_cb, and half in
channeld_tell_depth.  It's very confusing as a result,
with splicing, dual-funding and zeroconf.

This does introduce a behaviour change: if a channel is NORMAL and
it gets reorganized, we force close (unless we were the one who funded
it, or it's zeroconf anyway).  This is safer than continuing to use
the channel in this case!

Some tests are changed to zeroconf to make them work, but v2 doesn't
support zeroconf, so that's removed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell c0ffb17661 lightningd: make dualopen_tell_depth match channeld_tell_depth.
Rename slightly, remove first arg, and make it a noop of
there's no owner on channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 328d685a2a lightningd: don't report original depth once splice started.
This is a workaround, the real fix is to use a different
callback for inflight splice attempts, which comes later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 58d27c4bdc lightningd: clean up channel_tell_depth.
It's a mess right now.

Try to express it as a switch() statement over the states we can be in.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell fe0959fd31 lightningd: disconnect on *any* transient error, except abort
Not just if htlc addition is too slow, make this the default.  dual-open's txabort
is excluded, however.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 8dcfe1a75c pytest: make test_splice_gossip more precise.
Check the exact scids.  Makes it simpler when failures occur.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell eaf76ddbd6 doc: fix listpeerchannels schema to allow CHANNELD_AWAITING_SPLICE in state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell c52ab02bc9 patch remove-developer-test-annotations.patch 2023-10-02 11:41:19 +10:30
Rusty Russell 6203d250bf pytest: fix flake in upfront warning.
This is actually a real issue (l1 doesn't see the warning before l2
drops the connection), but it's unrelated to this PR, and will require
another one to fix.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 57a3680449 contrib/pyln-grpc-proto/ regenerate.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
Rusty Russell 25a4b96ebc poetry: run poetry update.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-10-02 11:41:19 +10:30
ShahanaFarooqui 77e3c3a38e plugin/clnrest: Adjusting flask-cors install after rebase 2023-09-29 16:00:05 +09:30
Christian Decker 452b45f675 lnproto: Remove unused report upload on GH Actions 2023-09-29 16:00:05 +09:30
Christian Decker 9afcec0404 lnproto: Fix up the lnprototest docker image 2023-09-29 16:00:05 +09:30
Christian Decker 414f65fc66 py: Add the grpc extra to pyln-testing dependency 2023-09-29 16:00:05 +09:30
Christian Decker 1242012efb gen: Update generated files 2023-09-29 16:00:05 +09:30
ShahanaFarooqui e010eece1b plugins/clnrest: Updated clnrest's requirements.txt
Even after migrating from pip install to poetry install for clnrest,
we still need to keep `plugins/clnrest/requirements.txt` for Fedora-28-amd64
build. `Dockerfile.builder.fedora` does not have poetry and will need
requirements.txt to install libraries with pip.

It is also required for non-developers who want to build cln from a tagged or master version.
2023-09-29 16:00:05 +09:30
ShahanaFarooqui 4301030a12 plugins/clnrest: Updated clnrest install command in Docker images and CI
We do not need explicit clnrest dependencies installation for clnrest
because `poetry install` will also install clnrest libraries.
2023-09-29 16:00:05 +09:30
ShahanaFarooqui 6a756256c0 plugins/clnrest: Adding pyproject.toml for Poetry install
Reference links:
https://github.com/ElementsProject/lightning/issues/6637
https://github.com/nix-community/poetry2nix

Changelog-Changed: Upgraded clnrest to poetry project.
2023-09-29 16:00:05 +09:30
Vincenzo Palazzo 7354a9ee1c lnprototest: bump to the new version
Thi commit includes the following change in lnprototest:

- cln: fix the check on the exit code (https://github.com/rustyrussell/lnprototest/pull/111)

Link: https://github.com/ElementsProject/lightning/issues/6727
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-09-29 12:57:57 +09:30
Vincenzo Palazzo 57ead06e3c ci: autopublish rust crates on tag event
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-09-28 14:00:59 +02:00
Vincenzo Palazzo a51894f510 rust: fixes the dependencies build with the rustc 1.73.0
This commit is just bumping the Cargo.lock file to
fix the following build issue with the more
recent rust version.

cargo build --quiet --example cln-plugin-startup
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/vincent/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.59/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous error

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-09-28 14:00:59 +02:00
Matt Whitlock 15b1ccb149 Makefile: use `xargs -0` consistently
In its default mode, `xargs` interprets any whitespace as a delimiter,
and it interprets single and double quotes and backslashes specially.
This can play havoc when fed by tools that don't escape these special
characters in their output.

Fortunately, `xargs` (at least the GNU version of it) has a `-0` option
that changes the behavior so that only NUL characters act as delimiters,
and no other characters have any special meaning. Use this option
consistently to avoid any nasty surprises.

Note that `git-ls-files` has a `-z` option that causes it to terminate
filenames on output with a NUL character instead of a newline, and
`grep` has a `-z` option that causes it to operate on NUL-terminated
records rather than on lines. Use these options together with
`xargs -0`.

Note: This commit corrects an oversight introduced in
9d94687b0d.

Changelog-None
2023-09-27 13:01:39 +09:30
Christian Decker 4121941d92 pytest: Fix elementsd tests 2023-09-26 19:21:05 +02:00
Christian Decker 9a51418e82 gci: Update apt before installing
A stale apt-get cache could otherwise cause a test failure.
2023-09-26 19:21:05 +02:00
Christian Decker d82d561593 gci: Print envvars and configuration when testing 2023-09-26 19:21:05 +02:00
Christian Decker 36494b6a51 gci: Only install one of elementsd or bitcoind
We were accidentally testing against `bitcoind` rather than
`elementsd` which meant we believed everything was find, when in
reality some tests broke. By only installing the required daemon we
ensure that such a mixup causes a CI failure.
2023-09-26 19:21:05 +02:00
Christian Decker 8ac63daf71 ci: Unbreak the liquid-regtest run on Github Actions 2023-09-26 19:21:05 +02:00
hMsats dc16f3411b Only 3 question marks for 4 variables 2023-09-26 11:52:27 +02:00