Commit Graph

986 Commits

Author SHA1 Message Date
Michael Schmoock 3f651b08d5 pygossmap: cleanups and optimizations
- moves offset into GossipHeader hdr which is passed to all constuctors
 - reads .flags as u16 instead of extracting it from the .length, see 0274d88ba
 - adds zombie and ratelimit flag to GossipHeader
 - bytes_read start at 0 instead of 1 which is more correct,
   the one byte is then corrected for when setting the offset of new header.
 - bytes_read is increased in pull_bytes as this is the only place where
   something is read
 - use new style for various format-strings
2023-04-05 06:13:08 +09:30
Michael Schmoock 882cafd3c7 pytest: adds skipped test_create_gossip_mesh
This can be adapted and used to create test gossip stores.
The test is just skipped by design as it would fail on intention.
2023-04-05 06:13:08 +09:30
Michael Schmoock fb0027e314 pyln-testing: fundbalancedchannel default total_capacity to FUNDAMOUNT 2023-04-05 06:13:08 +09:30
Michael Schmoock 407d4d2922 pyln-testing: remove deprecated fund_channel
This method is no longer used in cln nor in the plugins repo.

Changelog-None
2023-04-05 06:13:08 +09:30
Michael Schmoock f4b8a401cd pyln-proto: shorten ShortChannelId.from_str() 2023-04-05 06:13:08 +09:30
Christian Decker 7d7b2abd02 msggen: Allow using deprecated fields in the rpc -> grpc conversion
We should rather hand the annotation through to the user code, and
warn there.
2023-03-24 00:23:43 +00:00
Greg Sanders cf662e55a7 Make startup_regtest.sh more robust to bitcoind wallet state 2023-03-23 16:10:55 +10:30
Greg Sanders cb7caa3139 Re-enable PSBT tests for Liquid except test_sign_and_send_psbt 2023-03-23 16:10:55 +10:30
Kristaps Kaupe 906279a46e Output channel_id in listfunds
Changelog-Added: JSON-RPC: `listfunds` now has a `channel_id` field.
2023-03-21 10:29:33 +00:00
Rusty Russell 983542f2a7 global: remove deprecated "msat" suffix on msat fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: the "msat" suffix on millisatoshi fields, as deprecated in v0.12.0.
2023-03-18 15:55:49 +10:30
Rusty Russell 780f32dfc6 global: remove deprecated non-msat-named msat fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: all the non-msat-named millisatoshi fields deprecated in v0.12.0.
2023-03-18 15:55:49 +10:30
Rusty Russell 67f23c19f7 lightningd: remove deprecated local_msat, remote_msat from listpeers.
Changelog-Removed: JSON-RPC: `listpeers`.`local_msat` and `listpeers`.`remote_msat` (deprecated v0.12.0)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-03-18 15:55:49 +10:30
Alex Myers 538a8d5c57 meta: update changelog and pyln version for 23.02 release
Changelog-None
2023-03-02 12:14:50 -06:00
Alex Myers 0707ffcab4 reprobuild: use pyenv for python installation
python-setuptools installation was flakey on some systems. Installing
with pyenv should provide a more reproducible build.

Changelog-None
2023-03-02 12:11:02 -06:00
Christian Decker c7fd13a460 repro: Add `protoc` dependency to repro-build 2023-03-02 12:11:02 -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
Riccardo Casatta 510abb934c cln-grpc: add roundtrip tests for test_getinfo and test_listppers 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
Michael Schmoock 1e951a9479 mssgen: adds 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
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
Michael Schmoock 3efbc12706 pyln-client: adds utils cln_parse_rpcversion
This adds the `cln_parse_rpcversion` helper that is already used in
various plugins to pyln-client, so it does not need to be copied
around anymore.

Changelog-None
2023-02-03 16:58:31 +01:00
Michael Schmoock 3dde1ca399 pyln-testing: fix wait_for_htlcs helper
When doing the updates on the plugin repo, I discovered that
this helper function got broken by the `listpeerchannels` upgrade.

Its rarely used in the main repo, just at the end of the pyln-testing
'pay' helper.

If unfixed, this bug may result in test flakes when using the `pay`
helper, because its not correctly waiting for all HTLCs to be resolved
before returning.

Changelog-None
2023-02-02 18:47:08 +01:00
Rusty Russell 83c690fe5f doc: fix listsendpays man page.
We actually had a partid allowed (in the oneOf clauses), but didn''t
document it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-30 15:15:41 -06:00
Rusty Russell 9ab488fc41 plugins/topology: add direction field to listchannels.
It's a core concept in the spec which isn't directly exposed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listchannels` added a `direction` field (0 or 1) as per gossip specification.
2023-01-30 15:15:41 -06:00
Rusty Russell 611795beee listtransactions: get rid of per-tx type annotations.
We didn't actually populate them properly, and the real annotations
are on inputs and outputs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: JSON-RPC: `listtransactions` `channel` and `type` field removed at top level.
2023-01-30 15:15:41 -06:00
Rusty Russell 4b9cb7eb76 doc: remove unused offerout schema.
We removed the command for v22.11.

Also, we removed the `refund_for` offer parameter, so remove its description
from the manpage.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-30 15:15:41 -06:00
Riccardo Casatta 182a9cdcb6 cln-rpc: use serde rename instead of alias
rename is necessary to roundtrip, otherwise the rust name is used.

This also remove the rename if they are not necessary.

Note that:
```
 #[serde(rename="foo", skip_serializing_if=="bar")]
 pub field: bool,
```

is equivalent to:
```
 #[serde(rename="foo")]
 #[serde(skip_serializing_if=="bar")]
 pub field: bool,
```

and for simplicity of construction the latter is used
2023-01-26 15:03:54 +01:00
Rusty Russell 932ca9e91f lightningd: deprecate p2sh-segwit addresses for `newaddr` `addresstype`
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: JSON-RPC: `newaddr`: `addresstype` `p2sh-segwit` (use default, or `bech32`).
2023-01-14 21:17:45 +10:30
Rusty Russell 85fc46f76c pyln-testing: don't default openchannel and fundwallet to p2sh-segwit, use bech32.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-01-14 21:17:45 +10:30
Vincenzo Palazzo f08d3516f7 contrib/pyln-testing: use listpeerchannels. 2023-01-13 10:42:42 +10:30
Vincenzo Palazzo 6fa904b4fb lightningd: add listpeerchannels command
Changelog-Added: JSON-RPC: new command `listpeerchannels` now contains information on direct channels with our peers.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-13 10:42:42 +10:30
Justin Litchfield 879db694e1 Ping request types are changed from number to u16 2023-01-09 14:35:23 +01:00
arowser f918a04738 unify the zlib version 2023-01-05 14:42:00 +01:00
arowser 90956fa947 change zlib download path 2023-01-05 14:42:00 +01:00
ekzyis 87a0cb1603 Replace head -n with sort -R for better random peer selection 2023-01-04 13:29:46 +10:30
Jesse de Wit 241cd8d012 generate composite fields in grpc 2023-01-03 10:56:10 +01:00
Michael Schmoock af502eb625 pytest: adds test for msat to int comparison
Changelog-None
2023-01-02 11:42:17 +01:00
Michael Schmoock 6f46010417 pyln-client: make Millisatoshi comparable to int
This often helps the msat purge and pyln msat replacement mischmasch issues.
I changed it in a way that the `AttributeError: 'int' object has no attribute 'millisatoshis'`
Error will still be raised whever a `Millisatoshi` is compared to
something else then a `Millisatoshi` or `int`.

Changelog-None
2022-12-29 13:00:42 +01:00
Christian Decker 8e75232205 rs: Update outdated dependencies
This commit updates outdated dependencies and hangs all
bitcoin-related dependencies off of the `bitcoin` crate, using its
re-exports. This means that as long as the bitcoin crate matches, all
of its dependents will also match.

Changelog-None
2022-12-22 15:42:12 +01:00
Greg Sanders 3b56e90a13 Turn on logging for key topics in bitcoind for black box tests 2022-12-22 12:05:01 +01:00
Rusty Russell 68f3e3fba9 pyln: add datastore routines.
Without explicit definitions, we don't get proper names args and help
messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-12-22 12:04:30 +01:00
Greg Sanders c79c9c73fc Properly raise ValueError message in wait_for 2022-12-19 13:09:46 +01:00
Rusty Russell 5b3746172f lightningd: remove `setchannelfee`.
Replaced by `setchannel`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changlog-Removed: JSON-RPC: `setchannelfee` (deprecated in v0.11.0)
2022-12-13 08:28:12 +10:30
Christian Decker 6af78c35df misc: Update cdecker's gpg key 2022-12-06 16:37:19 +01:00
nicolas.dorier a96ff3b097 Update the contrib arm32v7 and arm64v8 dockerfiles 2022-12-06 10:48:57 +01:00
Christian Decker d7cd3e1cb5 pyln: Fix an issue with the LightningConnection short-reading
We may end up with a short read, that is not empty, when a message
gets fragmented during transport, so we need to loop until we either
reach the full size or we have an empty read indicating a dropped
connection.

Changelog-None
2022-12-02 12:20:24 +01:00
Rusty Russell ece77840f9 pyln-client, libplugin, rust cln-plugin: explicitly flag that we allow non-numeric JSON ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-21 11:23:54 +01:00
Christian Decker 9481fb8815 msggen: Be less magic in detecting the repo root
We were assuming that we are running in a git repo, which is not true
for the PPA
2022-11-18 15:10:32 +01:00
Christian Decker d4ead53652 pyln: Bump versions 2022-11-11 10:37:37 +01:00
Rusty Russell d45b13df56 lightningd.service: note that the hardening setting seems to break node.js plugins
See-also: https://github.com/Ride-The-Lightning/c-lightning-REST/issues/116
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-11 08:47:59 +01:00
Rusty Russell 02d7454226 db: add invoicerequests table.
We no longer use offers for "I want to send you money", but we'll use
invoice_requests directly.  Create a new table for them, and
associated functions.

The "localofferid" for "pay" and "sendpay" is now "localinvreqid".
This is an experimental-only option, so document the change under
experimental only.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: JSON-RPC: `pay` and `sendpay` `localofferid` is now `localinvreqid`.
2022-11-09 15:08:03 +01:00
Rusty Russell ef2f4a0648 bolt12: use spec field names, update decode API.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-09 15:08:03 +01:00
niftynei 26f5dcd2a5 wallet: mark coinbase outputs as 'immature' until spendable
Changelog-Changed: JSON-RPC: `listfunds` now lists coinbase outputs as 'immature' until they're spendable
Changelog-Changed: JSON-RPC: UTXOs aren't spendable while immature
2022-11-09 11:55:25 +01:00
Rusty Russell b6134303d4 pyln: add context manager to simpify filter use.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: pyln: LightningRpc has new `reply_filter` context manager for reducing output of RPC commands.
2022-11-09 20:25:58 +10:30
Rusty Russell 1436ad334d pytest: add filter tests.
We suppress schema reply checking when filter is set: we could just
remove all the `required` fields in the JSON schema.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-11-09 20:25:58 +10:30
Christian Decker 1a1c0a38fc msggen: Map the `extratlvs` field of `keysend`
Changelog-Added: cln-rpc: `keysend` now exposes the `extratlvs` field
2022-11-01 17:05:30 +01:00
Rusty Russell 662c6931f3 Remove point32.
The x-only dream is dead.  Remove all trace.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-10-26 11:29:06 +10:30
Christian Decker 62bfed9a8d docker: Add bitcoin-cli to the alpine dockerfile 2022-10-15 13:42:58 +02:00
Christian Decker 6fb653ef97 docker: Separate builder from runner stage in alpine docker image
Should result in smaller images.
2022-10-15 13:42:58 +02:00
Christian Decker 0acdc911a5 docker: Build the alpine docker image from a clone
This was causing some issues because it was picking up pre-built
artefacts from the host machine. By cloning first we ensure it matches
the latest commit and compiles from scratch.
2022-10-15 13:42:58 +02:00
Christian Decker 1f5e579f1b docker: Clean up dependencies for alpine build 2022-10-15 13:42:58 +02:00
briancolecoinmetrics f0d81f46f0 Clean up Dockerfile.alpine
bump Dockerfile.alpine from Alpine 3.14 to 3.16 (current stable) and remove apparently redundant dependencies.
2022-10-15 13:42:58 +02:00
Christian Decker a99509db36 py: Update protobuf dependency to silence dependabot 2022-10-14 19:31:39 +02:00
Dustin Dettmer 6aca9f665b devtools: Make fund_nodes compatible w/zsh
Mac is updating to using zsh in general.

The “for i in” reads strings with spaces as a single entry instead of multiple entries as sh did.

Using “while read” … “<<< $var” makes it treat each space as a new entry.

Changelog-None
2022-09-30 10:17:46 +02:00
joemphilips 52be59587c msggen: generate deprecated fields in rust.py 2022-09-29 11:18:06 +02:00
Rusty Russell 342e330b56 doc: update references to old BOLTs repo.
This reveals that common/test/run-bolt12_merkle-json.c was broken!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-29 16:10:57 +09:30
Christian Decker 6adb1e0b4b pytest: Bypass schema verification for some RPC calls
The goal here is to test the node validation, not whether we can
trigger the schema validation with bogus values. So we bypass the
verifying RPC wrapper.
2022-09-28 15:13:07 +02:00
Justin Litchfield 51e2433087 Setchannel request is provided 2022-09-28 15:13:07 +02:00
joemphilips 836a2aa261 use msat_or_all for fundpsbt request amount 2022-09-28 10:52:55 +02:00
Rusty Russell cafa1a8c65 db: correctly migrate forwards for closed incoming channels.
We have to allow them (as otherwise `fees_collected_msat` in getinfo breaks),
but it means that actually, in_htlc_id might be missing in listforwards
(also, out_htlc_id might be missing, which we didn't catch before).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: #5628
2022-09-27 14:42:03 +09:30
Christian Decker 657b315f1c pyln: Bump versions to v0.12.1
This is just before the introduction of `get_json_id`, but has the
correct dependency constraints such that all packages can be updated
to >=v0.12 and we don't mix minor versions.
2022-09-26 22:06:05 +02:00
elsirion b4b0b479ac Use `secp256k1` for public key type 2022-09-26 22:05:30 +02:00
elsirion e272c93a88 Use `bitcoin_hashes` for `Sha256` 2022-09-26 22:05:30 +02:00
elsirion 10917743fe Implement a typed version of `call` to avoid useless matching 2022-09-26 22:05:30 +02:00
Melroy van den Berg 87bab2b851 Add ConfigurationDirectory
Add ConfigurationDirectory for `/etc/lightningd ` as well.
2022-09-26 17:48:11 +02:00
Melroy van den Berg a7ce03bae6 The project is called Core Lightning
Rename project in the description of the service file.
2022-09-26 17:48:11 +02:00
Christian Decker 437ae11610 pytest: Configure the plugin logging to debug 2022-09-25 15:13:12 +02:00
Christian Decker b13ab8de3a msggen: Use owned versions to convert from cln-rpc to cln-grpc
We needed to clone a lot since we were using a non-mutable borrow of
the cln-rpc version to then create the cln-grpc version. This alone
reduces the number of allocations of the `listpeers` test from 52
allocations to 38.
2022-09-25 15:13:12 +02:00
Rusty Russell bb49e1bea5 common: assume htlc_maximum_msat, don't check bit any more.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-24 15:22:27 +09:30
Rusty Russell 6338758018 gossmap: make API more robust against future changes.
Many changes to gossmap (including the pending ones!) don't actually
concern readers, as long as they obey certain rules:

1. Ignore unknown messages.
2. Treat all 16 upper bits of length as flags, ignore unknown ones.

So now we split the version byte into MAJOR and MINOR, and you can
ignore MINOR changes.

We don't expose the internal version (for creating the map)
programmatically: you should really hardcode what major version you
understand!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-24 15:22:27 +09:30
Rusty Russell 264b4e02fa pyln-spec: update to latest spec.
In particular, some field names have changed. lnprototest in master
has already upgraded names, so this brings us into compatibility again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: pyln-spec: package updated to latest spec version.
2022-09-22 15:29:08 +02:00
Rusty Russell c04de577ab pyln-spec: update Makefile to use poetry for release, generate versions
1. Update default specdir to the new modern name.
2. Don't use python to extract version, use sed.
3. Use poetry publish.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:29:08 +02:00
Rusty Russell 05095313f5 lightningd: listsendpays always has groupid.
Schema was too loose since we did deprecations.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:19:46 +02:00
Rusty Russell 311807ff1f lightningd: add in_htlc_id / out_htlc_id to listforwards.
And document that we never know payment_hash.

Changelog-Added: JSON-RPC: `listforwards` now shows `in_htlc_id` and `out_htlc_id`
Changelog-Changed: JSON-RPC: `listforwards` now never shows `payment_hash`; use `listhtlcs`.
2022-09-22 15:19:46 +02:00
Rusty Russell 2752e04f8f db: add `scid` field to channels table.
Normally, we'd use the delete_columns function to remove the old
`short_channel_id` string field, *but* we can't do that for sqlite, as
there are other tables with references to it.  So add a FIXME to do
it once everyone has upgraded to an sqlite3 which has native support
for column deletion.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:19:46 +02:00
Rusty Russell bd76a196f5 autoclean: new interface
In preparation for more things being autocleaned.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 15:19:46 +02:00
Christian Decker 8ae0af7962 pyln: Bump pyln-client dependency in pyln-testing
They were contradicting each other.
2022-09-22 11:41:11 +02:00
Rusty Russell 7c2c100145 pyln: results of make update-pyln-versions NEW_VERSION=0.12.0
But I had to make the pyln-proto requirement of pyln-client less
strict.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 11:41:11 +02:00
Rusty Russell 3c80b22d6f pyln: use poetry version, add target to check version, use poetry publish.
Remove non-working test-release target.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-22 11:41:11 +02:00
Christian Decker b9a7f36ab3 msggen: Add conversion from cln-rpc to cln-grpc for Option<Outpoint>
We didn't have optional Outpoints as arguments so far, so let's
backfill that.

Changelog-Changed: cln-rpc: The `wrong_funding` argument for `close` was changed from `bytes` to `outpoint`
2022-09-22 10:41:05 +02:00
Rusty Russell 5a1c2447cb pyln-client: use f strings to concatenate JSON ids, handle older integer ids.
We don't really support using pyln-client with older Core Lightning versions,
but this is neater anyway.  I checked: f-strings go back to python 3.6, so
we can use them (I think this may be the first!).

Suggested-by: @MiWCryptAnalytics
Fixes: #5609
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-21 12:15:48 +02:00
Christian Decker 5c1de8029a openingd: Add `reserve` to `fundchannel` and `multifundchannel`
Changelog-Added: JSON-RPC: `fundchannel`, `multifundchannel` and `fundchannel_start` now accept a `reserve` parameter to indicate the absolute reserve to impose on the peer.
2022-09-21 11:25:47 +02:00
Christian Decker ab95d2718f pyln: Reduce dependency strictness for pyln-testing 2022-09-20 10:33:40 +02:00
Rusty Russell d2edeff698 contrib/giantnode.py: populate three regtest nodes with many invoices/forwards/payments.
If you don't want to run this (and it's v slow without the coming
optimizations!) you can download a copy from:

	https://ozlabs.org/~rusty/giantnodes.tar.xz

(Unpack in /, then just `start_ln 3`).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-18 16:21:54 +02:00
Rusty Russell a99a72be9b contrib/startup_regtest.sh: misc fixes and add destroy_ln, print usage.
We weren't consistent with passing through regtest, and we should be.
Also, destroy_ln is useful for getting rid of all dirs.  Finally, use
eatmydata if it's available.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-18 16:21:54 +02:00
niftynei 37fc0d8c6f docker: use pip install + poetry export instead of poetry update
I dunno man, poetry just seems like a mess.
2022-09-18 09:48:50 +09:30
Christian Decker 37c07ddfe5 pyln: Add grpcio and protobuf dependencies to pyln-testing 2022-09-17 13:45:51 +02:00
Rusty Russell fdc59dc94a contrib/pyln-testing: pass through id correctly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-16 12:31:45 +09:30
Rusty Russell f1f2c1322d contrib/pyln-client: construct JSON ID correctly.
They can set their name explicitly, but if they don't we extract it from argv[0].

We also set it around callbacks, so it will be expanded by default.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-16 12:31:45 +09:30
Rusty Russell ed3f700991 lightningd: use string as json req ids when we create them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-16 12:31:45 +09:30
Rusty Russell bd18fbc488 contrib/pyln-client: allow lightningd to give us non-numeric ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-16 12:31:45 +09:30
Christian Decker cb3ee0ac2e wallet: Load and value `completed_at` timestamp from DB 2022-09-14 13:14:10 +02:00
niftynei c143914ebf bkpr: migration to delete any duplicate lease_fee entries
Clean up for #5557.

If you've got duplicate 'lease_fee' entries, we delete them!
2022-09-14 15:59:37 +09:30
niftynei 7df530d184 builds: cleanup duplicate and unused code, fix spelling
Few extremely minor updates to the ubuntu dockerfile and ci builds
2022-09-10 11:24:31 +09:30
niftynei 34a0d7083a build: use ubuntu 22.04 LTS
Requires us to update to latest lnproto which is now using the most up
to date python-bitcoinlib, as well as updating our python lock files
(which pin the grpcio deps, because of locking problems h/t @cdecker)
2022-09-10 11:24:31 +09:30
Rusty Russell cde93ab703 doc: document that we can build lowdown, remove from Alpine.
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 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
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
niftynei 071b1bc4f1 pyln: update versions to v0.12.0 2022-08-02 10:00:26 -07:00
niftynei 4e503f7d0a bkpr/listpeeers: add lease_fees back to funds; separate out in listpeers
First, how we record "our_funds" and then apply pushes vs lease_fees
(for liquidity ad buys/sales) was exactly opposite.

For pushes we were reporting the total funded into the channel, with the
push representing how much we'd later moved to the peer.

For lease_fees we were rerporting the total in the channel, with the
push representing how much was already moved to the peer.

We fix this (from a view perspective) by re-adding lease fees to what's
reported in the channel funding totals. Since this is now new behavior
(for leased channel values), we added new fields so we can take the old
field names thru a deprecation cycle.

We also make it possible to differentiate btw a push and a lease_fee
(before they were all the same), by adding to new fields to `listpeers`:
`fee_paid_msat` and `fee_rcvd_msat`.

This allows us to avoid math in the bookkeeper, instead we just pick
the numbers out directly and record them.

Fixes #5472

Changelog-Added: JSON-RPC: `listpeers` now has a few new fields for `funding` (`remote_funds_msat`, `local_funds_msat`, `fee_paid_msat`, `fee_rcvd_msat`).
Changelog-Deprecated: JSON-RPC: `listpeers`.`funded` fields `local_msat` and `remote_msat` are now deprecated.
2022-07-31 21:53:05 +09:30
niftynei 3c79a456c0 test-db-provider: if postgres in tests, startup a bookkeeper db
FXIME: Has a edge case where if you disable the bookkeeper, it'll
blowup because you've got an option that isn't present anywhere...
2022-07-28 12:08:18 +09:30
niftynei 5c45939acf test-utils: add the bolt11 invoice
nice to have for making tests that assert on description/bolt data
2022-07-28 12:08:18 +09:30
Christian Decker b55df5c626 msggen: Use tempfile + rename to make changes to .msggen.json atomic
This was causing issues when multiple instances of msggen were running
in parallel on CI.

Changelog-None
2022-07-26 09:49:20 -07:00
niftynei b6bf352503 contrib startup-regtest: turn off deprecated apis, update deprecated
Update an out of date config, turn off deprecated apis by default for
all regtest tests. (Makes sense, this is a devtool)
2022-07-23 16:22:38 +09:30
Rusty Russell 4cada557ba pytest: don't redirect stderr by default.
Some tests need to inspect it, but most don't, and I suspect I'm missing some
error messages due to this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-07-21 15:37:05 -05:00
Christian Decker b48ae58b56 repro: Update ubuntu jammy reprobuild 2022-07-21 15:21:12 -05:00
Christian Decker 9c945dbc68 reprobuild: Add Rust compiler to repro build docker images
Changelog-Added: build: Reproducible builds now include rust binaries such as the `cln-grpc` plugin
2022-07-21 15:21:12 -05:00
Christian Decker 76d05483fa pyln-testing: Add listinvoices to grpc shim 2022-07-21 14:19:06 +09:30
Christian Decker 217ce4c03c schema: Add missing `mindepth` argument to `fundchannel`
This was likely missed during the zeroconf PR.

Changelog-None
2022-07-21 14:19:06 +09:30
Christian Decker 20b2f0af85 pyln: Ignore generated files when linting 2022-07-21 14:19:06 +09:30
Christian Decker ed51c164c0 pyln-testing: Add `invoice` RPC method 2022-07-21 14:19:06 +09:30
Christian Decker 3f79536437 msggen: Ignore `state_changes` in grpc2py
It's being skipped in grpc so we don't have it later anyway.
2022-07-21 14:19:06 +09:30
Christian Decker b6a4cbbf98 cln-rpc: Add mindepth after rebase on `master` 2022-07-21 14:19:06 +09:30
Christian Decker 6df0a9281f pyln-testing: Add a couple of methods used in tests
These are the most used methods in tests, so we can start getting our
test coverage up.
2022-07-21 14:19:06 +09:30
Christian Decker 18a9eb2feb msggen: Add `stop` method to generators
We'll need this when testing the grpc interface in pyln-testing,
otherwise tests just slowly die and wither.
2022-07-21 14:19:06 +09:30
Christian Decker 12275d0bfe cln-grpc: Skip serializing fields when Option<Vec<T>> is empty too
The CLN API is rather strict about the fact that we should skip
providing a field whenever it is empty. Checking for `is_none` would
still include empty arrays.

Changelog-Fixed cln-rpc: Optional empty arrays will no longer be serialized in requests
2022-07-21 14:19:06 +09:30
Christian Decker 77f5eb556b msggen: Add fundchannel request 2022-07-21 14:19:06 +09:30
Christian Decker b8bcc7d13f pytest: Add a new RPC interface to talk to grpc
This allows us to re-use existing tests (assuming the call and fields
are covered by `cln-rpc` and `cln-grpc`) to test the full roundtrip
from test over the grpc interface to the json-rpc interface and back
again.

You can switch to the grpc interface by setting the `CLN_TEST_GRPC`
environment variable to 1, but for now only very few shims are
implemented (due to the non-generated nature of LightningRpc).
2022-07-21 14:19:06 +09:30
Christian Decker 5307586d4d msggen: Add a new generator for grpc -> python converter
To test the grpc interface we'll want to emulate the JSON-RPC
interface as best we can, hence when talking to the grpc interface we
want to convert back into a parsed JSON format as LightningRpc would
have returned it. This is just the simplest way of closing the loop
here:

```
  pyln-testing --grpc-> cln-grpc --grpc2json
     ^                                  |
     |                                  v
     |                               JSON-RPC
     |                                  |
    TEST                                v
     ^                                 CLN
     |                                  |
     |                                  v
  pyln-testing <-grpc2py-- cln-grpc <- json2grpc
```
2022-07-21 14:19:06 +09:30
Christian Decker bac322ccdb pytest: Move generated grpc bindings to pyln-testing
These may eventually end up in pyln-client, as they allow talking to
the GRPC interface exposed by cln-grpc, however for now they are used
for testing only. Once we have sufficient API and test coverage we can
move them and leave imports in their place.
2022-07-21 14:19:06 +09:30
Christian Decker 2d35c9a929 msggen: Do not override method names when loading Schema
We were overriding the name right when loading, which is bad since in
some languages we use the method name as tag in the requests, thus
renaming causes us to call something that isn't defined.

Changelog-Fixed: cln-rpc: Fixed a naming mismatch for `ConnectPeer` causing `connectpeer` to be called on the JSON-RPC
2022-07-21 14:19:06 +09:30
William Casarin 98185dfc2b startup_regtest: add connect helper
`connect 1 2` to connect from l1 to l2, etc
2022-07-18 20:37:32 -05:00
William Casarin a3f5d31b09 startup_regtest: add experimental-offers 2022-07-18 20:37:32 -05:00
Swapnil 6204d70a37 docs: fix contrib/ docs 2022-07-17 21:40:01 +09:30
Simon Vrouwe cc40243399 pyln-testing: print content of errlog file when _some_ node failed unexpected 2022-07-16 14:19:05 +09:30
Rusty Russell 9685c1adaf lightningd: remove getsharedsecret.
This was introduced to allow creating a shared secret, but it's better to use
makesecret which creates unique secrets.  getsharedsecret being a generic ECDH
function allows the caller to initiate conversations as if it was us; this
is generally OK, since we don't allow untrusted API access, but the commando
plugin had to blacklist this for read-only runes explicitly.

Since @ZmnSCPxj never ended up using this after introducing it, simply
remove it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSONRPC: `getsharedsecret` API: use `makesecret`
2022-07-15 22:17:58 +09:30
Christian Decker 1a9979784f contrib: Remove obsolete libhsmd_python class
This has been replaced with better rust bindings that can then be
consumed via pyo3, consolidating the C interface in a portable
wrapper.

Changelog-Removed: libhsmd: Removed the `libhsmd_python` wrapper as it was unused
2022-07-15 15:27:45 +09:30
Rusty Russell 68b45c2ae0 pytest: restore prefix to logging.
Since we now log directly, we don't prepend the prefix ourselves, making it really
hard to tell *which* lightningd the log applies to!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-07-09 09:59:52 +09:30
Alex Myers 9dc794dba8 gossipd: make use of new ratelimit bit in gossip_store length mask
routing.c now flags rate-limited gossip as it enters the gossip_store but
makes use of it in updating the routing graph. Flagged gossip is not
rebroadcast to gossip peers.

Changelog-Changed: gossipd: now accepts spam gossip, but squelches it for
peers.
2022-07-06 14:31:19 +09:30
Alex Myers cbafc0fa33 gossip_store: add flag for spam gossip, update to v10
This will be used to decouple internal use of gossip from what is
passed to gossip peers. Updates GOSSIP_STORE_VERION to 10.

Changelog-Changed: gossip_store updated to version 10.
2022-07-06 14:31:19 +09:30
Christian Decker 695a98e5d8 pyln-testing: Add `gossip_store` parser to testing framework
I had to parse quite a few of these files debugging zeroconf, so I
thought it might be nice to have direct access here.

Changelog-Added: pyln-testing: Added utilities to read and parse `gossip_store` file for nodes.
2022-07-04 22:14:06 +02:00
Christian Decker 185cd81be4 jsonrpc: Add `mindepth` argument to fundchannel and multifundchannel
This will eventually enable us to specify 0 for zeroconf channels.

Changelog-Added: JSON-RPC: Added `mindepth` argument to specify the number of confirmations we require for `fundchannel` and `multifundchannel`
2022-07-04 22:14:06 +02:00
Vincenzo Palazzo bad943da55 valgrind: ingore plugin build with rust
Ok this should be fixed the following stack trace


```
2022-06-29T14:19:41.183Z DEBUG   lightningd: Command returned result after jcon close
------------------------------- Valgrind errors --------------------------------
Valgrind error file: valgrind-errors.55581
==55581== Syscall param statx(file_name) points to unaddressable byte(s)
==55581==    at 0x4B0188E: statx (statx.c:29)
==55581==    by 0x1133481: std::sys::unix::fs::try_statx (weak.rs:178)
==55581==    by 0x11265E0: std::fs::buffer_capacity_required (fs.rs:851)
==55581==    by 0x112675B: <std::fs::File as std::io::Read>::read_to_string (fs.rs:644)
==55581==    by 0x10DACA8: num_cpus::linux::Cgroup::param (linux.rs:214)
==55581==    by 0x10DAB39: num_cpus::linux::Cgroup::quota_us (linux.rs:203)
==55581==    by 0x10DA9C2: num_cpus::linux::Cgroup::cpu_quota (linux.rs:188)
==55581==    by 0x10DA5A1: num_cpus::linux::load_cgroups (linux.rs:149)
==55581==    by 0x10DA23D: num_cpus::linux::init_cgroups (linux.rs:129)
==55581==    by 0x10DCDC8: core::ops::function::FnOnce::call_once (function.rs:227)
==55581==    by 0x10DC749: std::sync::once::Once::call_once::{{closure}} (once.rs:276)
==55581==    by 0x21EE89: std::sync::once::Once::call_inner (once.rs:434)
==55581==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==55581== 
==55581== Syscall param statx(buf) points to unaddressable byte(s)
==55581==    at 0x4B0188E: statx (statx.c:29)
==55581==    by 0x1133481: std::sys::unix::fs::try_statx (weak.rs:178)
==55581==    by 0x11265E0: std::fs::buffer_capacity_required (fs.rs:851)
==55581==    by 0x112675B: <std::fs::File as std::io::Read>::read_to_string (fs.rs:644)
==55581==    by 0x10DACA8: num_cpus::linux::Cgroup::param (linux.rs:214)
==55581==    by 0x10DAB39: num_cpus::linux::Cgroup::quota_us (linux.rs:203)
==55581==    by 0x10DA9C2: num_cpus::linux::Cgroup::cpu_quota (linux.rs:188)
==55581==    by 0x10DA5A1: num_cpus::linux::load_cgroups (linux.rs:149)
==55581==    by 0x10DA23D: num_cpus::linux::init_cgroups (linux.rs:129)
==55581==    by 0x10DCDC8: core::ops::function::FnOnce::call_once (function.rs:227)
==55581==    by 0x10DC749: std::sync::once::Once::call_once::{{closure}} (once.rs:276)
==55581==    by 0x21EE89: std::sync::once::Once::call_inner (once.rs:434)
==55581==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==55581==
--------------------------------------------------------------------------------
Leaving base_dir /tmp/ltests-hzt9ppqp intact, it still has test sub-directories with failure details: ['test_peers_1']
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-07-03 20:36:20 +09:30
Rusty Russell 4970704d24 pytest: fix gossipwith flake harder.
Even though we generally wait until a node has seen the gossip,
that doesn't mean that connectd has processed it!  This means when
we connect it may still send us "old" gossip.

So we set the OPT_GOSSIP_QUERIES bit, which means don't send until we
ask.  But now it sends us WIRE_QUERY_CHANNEL_RANGE, so everyone needs
to filter that out.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-06-27 17:21:35 +09:30