Commit Graph

1039 Commits

Author SHA1 Message Date
Dusty Daemon 0ed0a8f134 signed types: integer fix
integer was missing from the list of type conversions causing CI to fall over

ChangeLog-None
2023-07-31 21:00:22 +09:30
niftynei 95b3943ffe contrib/startup: ignore db-updates 2023-07-31 21:00:22 +09:30
Dusty Daemon 4628e3ace8 channeld: Code to implement splicing
Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
2023-07-31 21:00:22 +09:30
Dustin Dettmer 6472475714 Mac: Update Makefile to work on Mac zsh
Using the -n flag on echo is non-standard for zsh. printf ‘%s’ accomplishes the equivilent thing.

Changelog-Added: Small fix for Mac OS building

# Conflicts:
#	plugins/Makefile
2023-07-31 21:00:22 +09:30
Lagrang3 6ea6b0397e use of PATH_TO_BITCOIN in regtest
[ Quotes added to make shellcheck happy --RR ]
Signed-off-by: Lagrang3 <eduardo.quintana@pm.me>
2023-07-31 14:24:12 +09:30
Rusty Russell f51ce7be85 pytest: follow RBF txids properly, but ignoring identical "RBF" txs.
`mine_txid_or_rbf` uses is_in_log, which grabs the first line.  Thus it doesn't track when a txid gets "RBF"ed by itself, such as:

```
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat) with txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat)
...
INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 5df8474399e43c58cc45efb6acf1ae08fe678bea9a27d131628394a009cda361 (fee 122sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
...
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
...
DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: RBF onchain txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat) with txid 044a564a2b6f8c7c212246e4973a303d24ce0dcd31c470a9ea272f314cf6a4ce (fee 3630sat)
```

The simplest fix is to only use INFO lines, which are printed when we actually increase fee.

```
    def test_onchaind_replay(node_factory, bitcoind):
...
        # l1 should still notice that the funding was spent and that we should react to it
        _, txid, blocks = l1.wait_for_onchaind_tx('OUR_DELAYED_RETURN_TO_WALLET',
                                                  'OUR_UNILATERAL/DELAYED_OUTPUT_TO_US')
        assert blocks == 200
        bitcoind.generate_block(200)
        # Could be RBF!
>       l1.mine_txid_or_rbf(txid)

tests/test_closing.py:1860: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
contrib/pyln-testing/pyln/testing/utils.py:1292: in mine_txid_or_rbf
    wait_for(lambda: rbf_or_txid_broadcast(txids))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

success = <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f5d55f770d0>
timeout = 180

    def wait_for(success, timeout=TIMEOUT):
        start_time = time.time()
        interval = 0.25
        while not success():
            time_left = start_time + timeout - time.time()
            if time_left <= 0:
>               raise ValueError("Timeout while waiting for {}".format(success))
E               ValueError: Timeout while waiting for <function LightningNode.mine_txid_or_rbf.<locals>.<lambda> at 0x7f5d55f770d0>
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-28 09:44:58 +09:30
Christian Decker 7b8ea7f60a msggen: Add two missing fields to the `listpays` schema
The fields were missing because they weren't annotated with a type and
a description. Adding those fixes them.

Changelog-Fixed: msggen: `listpays` now includes the missing `amount_msat` and `amount_sent_msat` fields
No-schema-diff-check: fields were always there, just undocumented!
2023-07-27 12:40:28 +09:30
Shahana Farooqui 94205c094f plugins/clnrest: Update clnrest dependencies in scripts and Dockerfiles
Adding python3-json5 python3-flask python3-gunicorn flask_restx pyln-client
Also run `pip3 install -r plugins/clnrest/requirements.txt`
2023-07-25 19:20:16 +09:30
ff 6920e36135 added listhtlcs model 2023-07-24 09:07:24 +09:30
Rusty Russell d25a8ca0fd lightningd: expose created_index and updated_index fields.
If you miss a wait event, you can catch up by doing listinvoices and
getting the max of these fields.  It's also a good debugging clue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-23 13:48:37 +09:30
Rusty Russell 284262d006 listinvoices: add limit param.
Changelog-Added: JSON-RPC: `listinvoices` has `limit` parameter for listing control.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-23 13:48:37 +09:30
Rusty Russell 16c133746b listinvoices: add index and start params.
Now we have defined ordering, we can add a start param.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listinvoices` has `index` and `start` parameters for listing control.
2023-07-23 13:48:37 +09:30
Rusty Russell 7372b518ef pytest: test for setchannel's new ignorefeelimits.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 13:11:08 +09:30
Rusty Russell b529e79621 lightningd: `setchannel` can set `ignorefeelimits`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `setchannel` adds a new `ignorefeelimits` parameter to allow peer to set arbitrary commitment transaction fees on a per-channel basis.
2023-07-22 13:11:08 +09:30
Rusty Russell 8910529e6a lightningd: expose ignore_fee_limits field in listpeerchannels.
Changelog-Added: JSON-RPC: `listpeerchannels` has a new field `ignore_fee_limits`
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-22 13:11:08 +09:30
Christian Decker 975046a790 pyln: Make the grpcio dependencies optional
We also document how the grpc test mode works, and why it currently
lacks coverage.

Changelog-Changed: pyln-testing: The grpc dependencies are now optional.
2023-07-21 15:12:03 +09:30
Shahana Farooqui c0bb7f0721 lightningd: updating python v3.7 to v3.8 2023-07-20 11:44:46 +09:30
Shahana Farooqui 2e72387700 lightningd: removing bionic and python 3.7 support
Changelog-Removed: support for python v<=3.7 & Ubuntu bionic has been
removed.

clnrest's flask & gevent libraries require Python v>=3.8.
2023-07-20 11:44:46 +09:30
Dustin Dettmer aba4d18ed1 signed types: add handlers for signed types
We're adding signed types to the spec! This adds the support mechanisms
for them.
2023-07-13 19:34:47 +09:30
Rusty Russell 279b3aa7e8 pyln: add ability to subscribe to all notifications.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-13 18:59:37 +09:30
Greg Sanders 4b70736d13 Support p2tr deposit addresses
Changelog-Added: JSON-RPC: newaddr: p2tr option to create taproot addresses.
Changelog-Changed: Wallet: we now use taproot change addresses.
2023-07-11 11:41:15 +09:30
Rusty Russell e993818ffe pyln-proto: make point release.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-10 18:22:43 +02:00
Rusty Russell 2109f0b0ea pyln-client: make point release to prepare for next release.
People running master notice that calling listconfigs fails, because
we don't handle objects called xxx_msat correctly (see
d348554ff4).  This makes it painful
to test, until we release a pyln-client version.

Fortunately, the three changes in master are all fully backwards compatible,
so we can simply cut a release now and upload to pipy.org.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-10 18:22:43 +02:00
Christian Decker 53b37ca1c1 cln-rpc: Allow access to deprecated fields in conversions
This silences a compilation warning about accessing a deprecated
field. This was triggering on each build and we'll notice when they go
away, so why upset users with it?
2023-07-10 18:22:11 +02:00
Christian Decker 557cd183ac cln-rpc: Generate ToString for Enums
This will return the stringified name of the variant.
2023-07-10 18:22:11 +02:00
Christian Decker 32f9d78096 msggen: Derive `Eq` on generated Enums as well 2023-07-10 18:22:11 +02:00
Paul Miller a298f00229 rs: derive PartialEq for simple rust enums 2023-07-10 18:22:11 +02:00
Shahana Farooqui 4e5e38f4b0 tests: notification response fixes
tests: notification response fixes
2023-07-10 14:51:11 +09:30
Christian Decker 706b47587f cln-rpc: Remove wildcard import from model
There is a name clash between request and response for the delinvoicestatus
param.
2023-07-10 13:47:38 +09:30
Christian Decker 6583f0dead pyln: Create a dedicated pyln-grpc-proto package
Having the grpc bindings in the pyln-testing package was always a bit
strange, however it came with additional issues. Due to the way that
protos are handled by protobuf, any name clash, independently of where
we import the protos, would cause an import error. This usually
happens in diamond-pattern dependencies, and so pull out the generated
files into their own package that everyone else can rely on.

Changelog-None
2023-07-10 13:47:38 +09:30
Shahana Farooqui 2f489b97d1 docker: cl-repro Dockerfile update
Updating bionic, focal and jammy cl-repro builds:
- Rust version from 1.62 to 1.65
- Removed git clone, only mount option
- Removed sha256sums generation
2023-07-10 13:24:51 +09:30
Shahana Farooqui e752840849 docker: Core lightning Dockerfile updates
- Updated Dockerfile for amd64
- Removed linuxarm32v7.Dockerfile
- Removed linuxarm64v8.Dockerfile
- Added Dockerfile.arm32v7 for grpc enabled image
- Added Dockerfile.arm64v8 for grpc enabled image
2023-07-10 13:24:51 +09:30
Erik De Smedt db9dbc5f31 Remove --daemon from lightningd.service
When the `--daemon` flag is used, `lightningd` requires that `--log-file`
is used as well. By consequence, the `lightningd.service` didn't work
out-of-the-box for me.

This changes also sends the logs to `journald`.
The new approach is consistent with the `bitcoind.service` file in the bitcoin-core repository.

I prefer this approach because it comes with automatic log-rotation.
2023-07-09 13:02:10 +09:30
Tony Aldon dae6a0bcf2 contrib: fix id parsing in IO loop of cowsay.sh plugin 2023-07-06 16:18:46 +09:30
Rusty Russell 0402e645f0 lightningd: add option `opening_anchor_channel` to fundpsbt, utxopsbt.
This is needed when we know we're *opening* an anchor channel, to
override the "do we already have an anchor channel open?" logic.

Also, document the nonwrapped arg added in v23.02.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `fundpsbt` and `utxopsbt` new parameter `opening_anchor_channel` so lightningd knowns it needs emergency reserve for anchors.
2023-06-29 11:28:47 -04:00
Rusty Russell 7894d7136f pytest: adapt all the anchor-iff-EXPERIMENTAL tests to --experimental-anchors.
We use parameterization here.  The old `anchor_expected()` was for
non-zero-fee anchors, and have bitrotted so there are some other
changes as well.

Unfortunately, all the anchor accounting seems to be broken, but I
cannot understand these tests at all.  I had to simply disable them
for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-29 11:28:47 -04:00
Rusty Russell e45bf14300 lightningd: use lowball feerate for commit_tx on anchor channels.
Since we can CPFP, we don't have to track the feerate as closely.  But
it still needs to get in the mempool, so we use 10 sat/byte, or the
100 block estimate if that is higher.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `feerates` has new fields `unilateral_anchor_close` to show the feerate used for anchor channels (currently experimental), and `unilateral_close_nonanchor_satoshis`.
Changelog-Changed: JSON-RPC: `feerates` `unilateral_close_satoshis` now assumes anchor channels if enabled (currently experimental).
2023-06-29 11:28:47 -04:00
Rusty Russell 3b1652842e msggen: add new version string.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-29 11:28:47 -04:00
Christian Decker 6507d34b50 cln-grpc: Add some missing states to HtlcState 2023-06-23 14:38:23 +09:30
Vincenzo Palazzo fdb676491f pyln-proto: expose the tlv types
Exposing the tlv types to allow public access to it.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-06-23 13:32:25 +09:30
Bryan Ramos 7a57f7024c Added sample config file 2023-06-21 14:57:34 +09:30
Christian Decker 9f1e1ada2a py: Update dependencies and relax constraints
We were being very restrictive when describing the dependencies, so let's
relax them a bit.
2023-06-18 11:00:32 +09:30
Matt Morehouse d5645d28a7 contrib: script to generate Clang coverage report
The script converts a raw Clang coverage profile to an HTML report.
2023-06-15 10:47:56 +09:30
Vincenzo Palazzo 05c13ddfc5 fix(pyln): regenerate the autogenerated files
I noted in some PR that we are failing during the diff of the autogenerated files.

So this will generate the last version of them!

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-06-14 16:36:31 +02:00
Christian Decker 8c02d9587d msggen: Extend support range to v0.10.1 and mark address, added in v23.02 2023-06-13 11:28:35 +09:30
Vincenzo Palazzo 13836ddd2f fix: increase version cryptography python dep
Due to a security report by github, we should increase
our cryptography lib version.

This may impact potential another version that is stuck
with a cryptography version.

Link: https://github.com/ElementsProject/lightning/issues/6164
Reported-by: @dni
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-06-07 21:06:44 +02:00
Rusty Russell ea928bfca1 pytest: use modern listconfigs.
Use the configs object, as the others are about to be deprecated.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Rusty Russell 0df97547dd lightningd: don't simply ignore defaults on flags, deprecate.
Changelog-Deprecated: Plugins: `default` no longer accepted on `flag` type parameters (it was silently ignored, so just don't set it).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Rusty Russell d348554ff4 pyln-client: don't try to convert objects to Millisatoshi.
The new listconfigs fields will be objects, and this messes us up!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Rusty Russell 45e16180bc lightningd: remove deprecated `null` for missing plugin options.
We leave the code in contrib/pyln-client/pyln/client/lightning.py to handle
msat null fields for now, though, for a bit more compatibility.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-03 10:50:29 +09:30
Rusty Russell 56eb24280c pyln-testing: allow protobuf v4
I need to update gprcio-tools, but it needs protobuf v4.  Christian
added this restriction in a99509db36 to
"Update protobuf dependency to silence dependabot", but perhaps it's
time to actually update?

```
$ poetry update
Updating dependencies
Resolving dependencies... (1.0s)

Because pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing depends on protobuf (>=3.20.3,<4)
 and grpcio-tools (1.54.0) depends on protobuf (>=4.21.6,<5.0dev), pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing is incompatible with grpcio-tools (1.54.0).
So, because cln-meta-project depends on both grpcio-tools (1.54.0) and pyln-testing (23.05rc2) @ file:///home/rusty/devel/cvs/lightning/contrib/pyln-testing, version solving failed.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-01 06:40:47 +09:30
Rusty Russell a7786ca742 Revert "Put bitcoind logging in stdout for pytest"
This reverts commit 1037bf3c43.
(It broke elementsd: we no longer see "Done loading")
2023-05-29 18:41:46 +09:30
Christian Decker c029de7d56 msggen: Add preapproveinvoice and preapprovekeysend to msggen 2023-05-29 14:50:13 +09:30
Greg Sanders 1037bf3c43 Put bitcoind logging in stdout for pytest 2023-05-25 11:07:45 +09:30
Jon Griffiths 8b4136bad5 build: remove gmp
Core and secp have not used gmp for a very long time now (core disabled
it in 2015).

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
2023-05-24 18:21:43 +09:30
Rusty Russell e7d4c3175a build: remove --enable-experimental-features / EXPERIMENTAL_FEATURES
Changelog-EXPERIMENTAL: Build: all experimental features are now runtime-enabled; no more ./configure --enable-experimental-features
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell b8aa3a579e listtransactions: remove annotations, which were only in EXPERIMENTAL_FEATURES.
I don't know if anyone was using them, they seem half-hearted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Shahana Farooqui d1cf88c62e meta: update changelog and pyln version for 23.05 release
Changelog-None
2023-05-10 09:50:38 -07:00
Shahana Farooqui 4f258a9354 meta: Add changelog for 23.05rc4 2023-05-09 14:04:14 -07:00
Matt Morehouse fe5f3cef51 pyln: remove unused variable
Variable inroduced in 708fb17 is making CI fail.
2023-05-09 13:15:36 -07:00
Shahana Farooqui ea23122880 meta: Add changelog for 23.05rc3 2023-05-05 10:20:27 -07:00
Christian Decker 708fb17fa2 pytest: Add helper to get a grpc stub and test decode 2023-05-05 09:24:07 -07:00
Christian Decker acc3bb2276 msggen: Switch signatures to string instead of bytes 2023-05-05 09:24:07 -07:00
Christian Decker ef9e0fcf60 pyln: Set the correct envvar for logging for rust plugins 2023-05-05 09:24:07 -07:00
Christian Decker fc26675336 msggen: Add DecodePay to the mappings
Changelog-Added: grpc: Added mapping for `listpeerchannels`, `listclosedchannels`, `decode` and `decodepay` RPC method
2023-05-05 11:54:41 +09:30
Christian Decker 0031f1160b msggen: Map arrays of hashes and add HtlcState enum 2023-05-05 11:54:41 +09:30
Christian Decker db843159ea msggen: Move overrides into the model itself
We were using per-type overrides which caused some asymmetries, where
conversions could end up dropping fields as we went along. Essentially
each conversion would need to override a superset of the previous one,
which then caused issues when attempting to close the loop. By
overriding on the model level we ensure that all representations are
equivalent and convertible into one another, at the expense of
overriding a bit more aggressively, which should be fine anyway.
2023-05-05 11:54:41 +09:30
Christian Decker b41cb2f005 cln-grpc: Rename the ChannelSide variants
IN/OUT => LOCAL/REMOTE
2023-05-05 11:54:41 +09:30
Christian Decker bff3b1ca8c msggen: Add ListClosedChannels and overrides 2023-05-05 11:54:41 +09:30
Christian Decker d28815f7b8 msggen: Disable grpc response -> json response temporarily
We use overrides that omit fields in some cases, which makes the
conversion lossy. This also means that until we complete the mapping
we can't reconvert back.
2023-05-05 11:54:41 +09:30
Christian Decker e7a96cac11 msggen: Normalize enum and field names if they contain a '/' 2023-05-05 11:54:41 +09:30
Christian Decker 65f5134643 msggen: Add ListPeerChannels to generated interfaces 2023-05-05 11:54:41 +09:30
Christian Decker 2a52e52015 jsonrpc: Add versioning annotation to listpeerchannels 2023-05-05 11:54:41 +09:30
Shahana 21cc16fb5b meta: Add changelog for 23.05rc2 2023-04-26 15:46:02 -07:00
Shahana Farooqui 15795c969a meta: Add changelog for 23.05rc1
Typo correction

Updated delpay changelog
2023-04-15 12:33:06 -07:00
Christian Decker 2e5ad0f417 pyln: Exclude all `cln-` plugins from valgrind 2023-04-13 18:13:28 -07:00
Joel Klabo c0d3eeb789 Fix Typo in startup_regtest.sh 2023-04-11 13:39:51 +09:30
Rusty Russell 89b96e8ac0 pyln-testing: add support to tell bitcoind not to include txs if fee is too low.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 17:26:47 +09:30
Rusty Russell cf80f0520a connectd: dev-report-fds to do file descriptor audit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 09:41:56 +09:30
Rusty Russell a000ee015a lightningd: do RBF again for all the txs.
Now we've set everything up, the replacement code is quite simple.

Some tests now have to deal with RBF though, and our rbf tests need work
since they look for the old onchaind messages.

In particular, when we can't afford the fee we want, we back off to
the next blockcount estimate, rather than spending all on fees
(necessarily).  So test_penalty_rbf_burn no longer applies.

Changelog-Changed: Protocol: spending unilateral close transactions now use dynamic fees based on deadlines (and RBF), instead of fixed fees.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 07:31:12 +09:30
Rusty Russell 3a3370f4c1 feerates: add `floor` field for the current minimum feerate bitcoind will accept
Changelog-Added: JSON-RPC: `feerates`: added `floor` field for current minimum feerate bitcoind will accept
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 07:31:12 +09:30
Rusty Russell c46473e615 lightningd: allow "NNblocks" and "minimum" as feerates.
And consolidate descriptions into lightning-feerates().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `close`, `fundchannel`, `fundpsbt`, `multifundchannel`, `multiwithdraw`, `txprepare`, `upgradewallet`, `withdraw` now allow "minimum" and NN"blocks" as `feerate` (`feerange` for `close`).
2023-04-10 07:31:12 +09:30
Rusty Russell 64b1ddd761 lightningd: clean up feerate handling, deprecate old terms.
Drop try_get_feerate() in favor of explicit feerate_for_deadline() and
smoothed_feerate_for_deadline().

This shows us everywhere we deal with old-style feerates by names.

`delayed_to_us` and `htlc_resolution` will be moving to dynamic fees,
so deprecate those.

Note that "penalty" is still used for generating penalty txs for
watchtowers, and "unilateral_close" still used until we get zero-fee
anchors.

Changelog-Added: JSON-RPC: `feerates` `estimates` array shows fee estimates by blockcount from underlying plugin (usually *bcli*).
Changelog-Changed: JSON-RPC: `close`, `fundchannel`, `fundpsbt`, `multifundchannel`, `multiwithdraw`, `txprepare`, `upgradewallet`, `withdraw` `feerate` (`feerange` for `close`) value *slow* is now 100 block-estimate, not half of 100-block estimate.
Changelog-Deprecated: JSON-RPC: `close`, `fundchannel`, `fundpsbt`, `multifundchannel`, `multiwithdraw`, `txprepare`, `upgradewallet`, `withdraw` `feerate` (`feerange` for `close`) expressed as, "delayed_to_us", "htlc_resolution", "max_acceptable" or "min_acceptable".  Use explicit block counts or *slow*/*normal*/*urgent*/*minimum*.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 07:31:12 +09:30
Rusty Russell cdb85d5618 lightningd: handle fees as blockcount + range.
Rather than have specific-purpose levels, have an array of
[blockcount, feerate], and rebuild the specific-purpose levels
for now on top.

We also keep a *separate* smoothed feerate, so you can ask for that
explicitly.

Since all the plugins used the same formula to derive the different
named fee levels, we apply the reverse to return to the underlying
estimates: updating the interface comes next.

This is ugly for now, but various specific-purpose levels will be
going away, as we shift to deadline-driven fees.

This temporarily breaks the floor calculation, so that test is
disabled.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 07:31:12 +09:30
Rusty Russell b53cc69cfd msggen: fix incorrect assertion.
Adding a new field with `added` fails:

```
AssertionError: Field Feerates.perkb.estimates[] does not have an `added` annotation
```

Looks like this assertion is wrong: we should get an added from the field itself or
from the .msggen.json file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-10 07:31:12 +09:30
Rusty Russell c5b7dbcd98 pytest: clean up wait_for_onchaind_tx interface, remove wait_for_onchaind_broadcast
Using single tuples in Python is ugly, so:
1. Rename wait_for_onchaind_tx to wait_for_onchaind_txs.
2. Make it take tuples explicitly.
3. Make wait_for_onchaind_tx a simpler wrapper/unwrapper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-07 11:49:09 +09:30
Rusty Russell 3e83bed460 pyln-testing: adapt wait_for_onchaind_broadcast function for when onchaind uses lightningd for broadcast.
We can no longer grab the tx in one line as we did with
wait_for_onchaind_broadcast, we need to track the broadcast from
lightningd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-07 11:49:09 +09:30
Christian Decker 168bc54700 msggen: Add VersioningCheck
This is a visitor that ensures every new field has at least an `added`
field, and that we don't change the `added` or `deprecated` annotation
after the fact.
2023-04-06 10:16:19 +09:30
Christian Decker 60b12ec096 msggen: Use the inferred optional field
Changelog-Changed: msggen: The generated interfaces `cln-rpc` anc `cln-grpc` can now work with a range of versions rather than having to match the CLN version
2023-04-06 10:16:19 +09:30
Christian Decker 392cacac81 msggen: Add an optional patch
This patch annotates the fields with a new `optional` attribute which
determines whether the field should be considered an inferred optional
due to being added or deprecated.
2023-04-06 10:16:19 +09:30
Christian Decker 5df469cfca msggen: Add patching system, add `added` and `deprecated` to Field
The patching system allows us to enrich the raw schema with some
additional information. In this specific case we want to backfill the
`added` and `deprecated` fields for the multiversion support.
2023-04-06 10:16:19 +09:30
Rusty Russell 13ae1a5168 pyln.testing: remove Throttler.
CI seems to block; Christian suggests the throttler may be to blame somehow?

Since trying to fix it made it worse, let's just remove it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-06 09:10:53 +09:30
Chris Guida 1507e87197 fix helloworld.py example in README for pyln-client 2023-04-05 15:28:32 +09:30
Michael Schmoock 04ea37d88f pygossmap: rename GossipStoreHeader to GossipStoreMsgHeader
Changelog-Added: pyln-client: Improvements on the gossmap implementation
2023-04-05 06:13:08 +09:30
Michael Schmoock 6e46a63c57 pygossmap: adds statistic and filter module
Includes a lot of useful filters and statistical methods.

To see a gossip_store summary:
```
s = GossmapStats(g)
s.print_stats()
```
2023-04-05 06:13:08 +09:30
Michael Schmoock f1b6047d69 pygossmap: store features for nodes and channels
also makes them acessible using bitmask functions
2023-04-05 06:13:08 +09:30
Michael Schmoock 3130f4ec27 pygossmap: read .disabled from channel_flags 2023-04-05 06:13:08 +09:30
Michael Schmoock 6a16a31a98 pygossmap: parse node addresses and other data 2023-04-05 06:13:08 +09:30
Michael Schmoock 9409f2f1ea pygossmap: adds get_neighbors and get_neighbors_hc flodding method 2023-04-05 06:13:08 +09:30
Michael Schmoock 5a9a3d83c9 pygossmap: adds get_halfchannel 2023-04-05 06:13:08 +09:30