Commit graph

1353 commits

Author SHA1 Message Date
ShahanaFarooqui
f640394ceb doc: Add details and script check for testnet4 2025-01-13 15:45:19 -08:00
ShahanaFarooqui
02b19a8796 pyln-spec: add testnet4 support 2025-01-13 15:45:19 -08:00
ShahanaFarooqui
740b7125de ci: Install poetry-plugin-export for poetry export command
Poetry will no longer include the `poetry-plugin-export` plugin by default, which is essential for exporting dependencies. So, we now need to install it explicitly.
2025-01-09 11:15:05 +01:00
Rusty Russell
d26ea6673d xpay: more accurately reflect pay when xpay-handle-pay is set.
Note that the slight code reorder changes the JSON order, which is generally
undefined, but our doc checker is very strict!

Changelog-Changed: `xpay` now gives the same JSON success return as documented by `pay` when `xpay-handle-pay` is set.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: https://github.com/ElementsProject/lightning/issues/7923
2024-12-17 15:49:03 +10:30
Rusty Russell
80c43ec97d injectpaymentionion: allow specification of actual amount which reaches destination.
This appears in listsendpays / listpays, and is useful information (if we know!).

This doesn't fix old payments, but means that xpay can use this for new payments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-17 08:14:45 +10:30
Rusty Russell
aaca16d313 doc: fix injectpaymentonion schema.
I used an unknown arg and it didn't complain.  injectpaymentonion's schema predated
the sweep which fixed up use of "additionalProperties".

Indeed, we were missing some properties!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-17 08:14:45 +10:30
Rusty Russell
cb1bd82c86 Final changes for v24.11
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-09 14:54:50 +10:30
Rusty Russell
cc07f9afc6 v24.11rc4: hopefully the final Release Candidate
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-06 15:35:11 +10:30
Rusty Russell
d196b9bb53 doc: document (and test) the injectonionmessage API.
It's actually tested by fetchinvoice, but doing an explicit test in Python
allows for schema checking!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `injectonionmessage` API simplified and documented.
2024-12-05 17:38:16 +10:30
Rusty Russell
b520543867 gossipd: log at trace, not debug for regular messages.
See: https://github.com/ElementsProject/lightning/issues/7899

A node with 23 connections gets far too many debug messages.

Changelog-Fixed: `gossipd` now does logging at trace, not debug level.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-12-05 11:43:50 +10:30
Se7enZ
f2716092be build: Remove unused Dockerfiles, scripts and Github action. 2024-12-03 11:56:23 +10:30
Rusty Russell
b8e5b122d2 decode: don't fail to decode just because a bolt12 invoice has expired.
In fact, there are several places where we try to decode old invoices,
and they should all work.  The only place we should enforce expiration is
when we're going to pay.

This also revealed that xpay wasn't checking bolt11 expiries!

Reported-by: hMsats
Fixes: https://github.com/ElementsProject/lightning/issues/7869
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `decode` refused to decode expired bolt12 invoices.
2024-11-30 13:17:55 +01:00
daywalker90
2ba05ef2b8 msggen: add missing rpc commands new to 24.11
Changelog-None
2024-11-28 17:39:26 +10:30
daywalker90
703c11515d msggen: add support for short_channel_id_dir and pubkey
Changelog-None
2024-11-28 17:39:26 +10:30
Rusty Russell
020bd97a5a startup_regtest: fix clnrest detection.
The .py extension gets stripped from the plugin name, so it didn't work.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-28 16:37:33 +10:30
Rusty Russell
39fbced71e contrib/startup_regtest: set grpc-port so we can start more than one.
A side-effect of having grpc start by default.  Annoyingly, if it
can't bind it simply exits, with no message, so I had to guess what
was happening.

Reported-by: @daywalker90
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-28 16:37:33 +10:30
ShahanaFarooqui
a3a33fe3be doc: Add GENERATE_EXAMPLES env
- Run with environment variable `GENERATE_EXAMPLES`
- Update cln version in getinfo example on `make update-versions`
- Added two `dev` configs, dev-no-plugin-checksum and dev-no-version-checks, to match CI listconfigs
- Changed commando rpc example from `getinfo` to `newaddr` to avoid unneccessary file updates for future builds
- Stabilized `bkpr-editdescriptionbyoutpoint`, `listclosedchannels` and `listaddresses` examples
2024-11-28 15:56:16 +10:30
ShahanaFarooqui
0a7956b6d4 ci: Add GENERATE_EXAMPLES env in CI & docker build script 2024-11-28 15:56:16 +10:30
ShahanaFarooqui
7ff6852073 pyln: Add GENERATE_EXAMPLES environment variable for Testing 2024-11-28 15:56:16 +10:30
ShahanaFarooqui
11b294d18e doc: pre-build CI fix due to newly tagged version
Changelog-None.
2024-11-28 08:55:18 +10:30
Rusty Russell
034d3c9628 Build: update to version 24.11rc1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-27 06:27:50 +10:30
ShahanaFarooqui
e568d69867 doc: Lock askrene example values 2024-11-26 21:45:19 +10:30
ShahanaFarooqui
9592facf83 doc: Lock example values
Changelog-Added: Test script generates all RPC documentation examples now.
2024-11-26 21:45:19 +10:30
Alex Myers
11580dfd43 pyln-testing: disable seeker autoconnect by default
This avoids test flakes, but can be explicitly set if needed.

Changelog-None
2024-11-24 12:03:16 +10:30
daywalker90
54e7ac6872 startup_regtest: remove experimental-offers flag
Changelog-None
2024-11-23 10:48:32 +10:30
Rusty Russell
4186591a70 pyln-client: restore backwards compatibility with CLN prior to 24.08
24.05 and before requires a "description" field.  We should not have removed it here
until that was EOL!

Changelog-Fixed: pyln-client: plugins now compatible with CLN <= 24.05 (broken in 24.08)
Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-22 09:12:27 +01:00
Alex Myers
dc878dc937 lightningd: add option for minimum seeker autoconnect peers
Changelog-added: Added option --autoconnect-seeker-peers, allowing seeker to reach out to new nodes for additional gossip.
2024-11-22 15:21:45 +10:30
Vincenzo Palazzo
6f0dbbb20f bolt12: allow to inject payer_metadata
Payer metadata is a field that controls the payer ID
provided during the fetchinvoice process.

There are use cases where this is highly useful, such as
proving that the payer has paid for the correct item.

Imagine visiting a merchant's website to pay for multiple offers, where
one of these offers is a default offer (with no description and no set amount).

In this scenario, the merchant could claim not to have received
payment for a specific item. Since the same offer may be used to
fetch invoices for different products, there needs to be a way to
identify which product the invoice corresponds to.

With this commit, it will be possible to inject payer metadata,
which helps solve the issue described above.

For example, possible payer metadata could be `to_hex(b"{payer_node_id}.{product_id}.{created_at}")`.

Changelog-Added: JSON-RPC: `fetchinvoice` allows setting invreq_metadata via `payer_metadata` parameter.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-19 22:54:22 +01:00
Michael Schmoock
5fe0c1c41e pyln-client: adds testcase for usage in manifest and print_usage 2024-11-19 11:50:42 +10:30
Michael Schmoock
49aaab5128 pyln-client: refactors usage string generation to reduce code duplication 2024-11-19 11:50:42 +10:30
Michael Schmoock
19fb5d8ae7 pyln-client: adds description to methods via docstring
The old `long_description` was removed and deprecated a while ago
without adding a proper replacement for plugin developers.
The getmanifest JSON that was to be used for that only knows `name` and `usage`.

This PR adds an optional `description` parameter that will be filled
with the methods docstring `__doc__` (if set).

Example:

    @p.method("example")
    def some_method(...)
        """some description"""
        ...

Changelog-Add: optional description paramter to Plugin.Method
2024-11-19 11:50:42 +10:30
ShahanaFarooqui
e352a72e5e shellcheck: shellcheck fixes 2024-11-19 09:05:55 +10:30
Rusty Russell
1b413502e0 lightningd: deprecate experimental-offers option.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: Config: `experimental-offers` (it's now the default).
2024-11-18 10:42:54 +01:00
Rusty Russell
e254d91bd2 docs: no longer tell people experimental-offers is required.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
7c2407ef48 xpay: new plugin which uses askrene, injectpaymentonion.
Changelog-Added: Plugins: cln-xpay, with associated `xpay` command for payments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
8c051c555e pyln-testing: don't skip renepay and askrene!
We called these `cln-renepay` and `cln-askrene` which meant we didn't
test them under valgrind!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
99cc81b90a pytest: Allow a specific lightningd for DEBUG_SUBD
e.g. "lightningd-1:xpay" or even "1:xpay" means it will only apply to l1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
611e430754 lightningd: injectpaymentonion should fail on re-attempts.
This is clearer than transparently succeeding: the user might think they
paid twice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
ShahanaFarooqui
117dd748ba doc: Add schema for listaddresses 2024-11-17 20:27:13 +10:30
Rusty Russell
c4cbb8671a lightningd: actually deprecate old close fields.
Changelog-Deprecated: `close` `tx` and `txid` field (use `txs` and `txids`)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 16:04:06 +10:30
Dusty Daemon
809f3b01d9 close: Print multiple txs; Fixes #6467
Changelog-Changed: `close` now outputs txs & txids of all closing transactions (splice candidates can cause there to be multiple).
2024-11-17 16:04:06 +10:30
Dusty Daemon
4500661bbf channeld: Add aggressive restart test
Changelog-None
2024-11-17 15:32:28 +10:30
Rusty Russell
fcebb33180 lightningd: deprecate decodepay.
It only works on BOLT11, and has long been replaced by the more
generic "decode".

Removing it will stop the confusion!

(Note: documentation claims it was introduced in 23.08, but that was
 wrong, as it's been in CLN since the beginning).

[ Fixup from: niftynei <niftynei@gmail.com> ]
Fixes: https://github.com/ElementsProject/lightning/issues/6419
Changelog-Deprecated: JSON-RPC: `decodepay`: use `decode`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:21:23 +10:30
Rusty Russell
bd0b8e960e pytest: fix flake in test_htlc_in_timeout
Since wait_for_onchaind_tx doesn't actually wait for the call to bitcoind to
return, we have a race in checking if the txid is in the mempool.  Fix this
by making wait_for_onchaind_tx actually wait for the response (except for delayed txs!).

```
2024-11-15T07:15:22.0836959Z     def test_htlc_in_timeout(node_factory, bitcoind, executor):
2024-11-15T07:15:22.0837722Z         """Test that we drop onchain if the peer doesn't accept fulfilled HTLC"""
2024-11-15T07:15:22.0838208Z     
2024-11-15T07:15:22.0838585Z         # HTLC 1->2, 1 fails after 2 has sent committed the fulfill
2024-11-15T07:15:22.0839137Z         disconnects = ['-WIRE_REVOKE_AND_ACK*2']
2024-11-15T07:15:22.0839741Z         # Feerates identical so we don't get gratuitous commit to update them
2024-11-15T07:15:22.0840304Z         l1 = node_factory.get_node(disconnect=disconnects,
2024-11-15T07:15:22.0840839Z                                    options={'dev-no-reconnect': None},
2024-11-15T07:15:22.0841285Z                                    feerates=(7500, 7500, 7500, 7500))
2024-11-15T07:15:22.0841673Z         l2 = node_factory.get_node()
2024-11-15T07:15:22.0842278Z         # Give it some sats for anchor spend!
2024-11-15T07:15:22.0842679Z         l2.fundwallet(25000, mine_block=False)
2024-11-15T07:15:22.0843013Z     
2024-11-15T07:15:22.0843342Z         l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2024-11-15T07:15:22.0843753Z         chanid, _ = l1.fundchannel(l2, 10**6)
2024-11-15T07:15:22.0844058Z     
2024-11-15T07:15:22.0844291Z         sync_blockheight(bitcoind, [l1, l2])
2024-11-15T07:15:22.0844606Z     
2024-11-15T07:15:22.0844958Z         amt = 200000000
2024-11-15T07:15:22.0845713Z         inv = l2.rpc.invoice(amt, 'test_htlc_in_timeout', 'desc')['bolt11']
2024-11-15T07:15:22.0846612Z         assert only_one(l2.rpc.listinvoices('test_htlc_in_timeout')['invoices'])['status'] == 'unpaid'
2024-11-15T07:15:22.0847141Z     
2024-11-15T07:15:22.0847430Z         executor.submit(l1.dev_pay, inv, dev_use_shadow=False)
2024-11-15T07:15:22.0847805Z     
2024-11-15T07:15:22.0848041Z         # l1 will disconnect and not reconnect.
2024-11-15T07:15:22.0848660Z         l1.daemon.wait_for_log('dev_disconnect: -WIRE_REVOKE_AND_ACK')
2024-11-15T07:15:22.0850393Z     
2024-11-15T07:15:22.0851297Z         # Deadline HTLC expiry minus 1/2 cltv-expiry delta (rounded up) (== cltv - 3).  cltv is 5+1.
2024-11-15T07:15:22.0852146Z         # shadow route can add extra blocks!
2024-11-15T07:15:22.0852622Z         status = only_one(l1.rpc.call('paystatus')['pay'])
2024-11-15T07:15:22.0853044Z         if 'shadow' in status:
2024-11-15T07:15:22.0853861Z             shadowlen = 6 * status['shadow'].count('Added 6 cltv delay for shadow')
2024-11-15T07:15:22.0854325Z         else:
2024-11-15T07:15:22.0854547Z             shadowlen = 0
2024-11-15T07:15:22.0854845Z         bitcoind.generate_block(2 + shadowlen)
2024-11-15T07:15:22.0855292Z         assert not l2.daemon.is_in_log('hit deadline')
2024-11-15T07:15:22.0855669Z         bitcoind.generate_block(1)
2024-11-15T07:15:22.0855950Z     
2024-11-15T07:15:22.0856406Z         l2.daemon.wait_for_log('Fulfilled HTLC 0 SENT_REMOVE_COMMIT cltv .* hit deadline')
2024-11-15T07:15:22.0856997Z         l2.daemon.wait_for_log('sendrawtx exit 0')
2024-11-15T07:15:22.0857360Z         l2.bitcoin.generate_block(1)
2024-11-15T07:15:22.0857741Z         l2.daemon.wait_for_log(' to ONCHAIN')
2024-11-15T07:15:22.0858137Z         l1.daemon.wait_for_log(' to ONCHAIN')
2024-11-15T07:15:22.0858644Z     
2024-11-15T07:15:22.0859068Z         # L2 will collect HTLC (iff no shadow route)
2024-11-15T07:15:22.0859741Z         _, txid, blocks = l2.wait_for_onchaind_tx('OUR_HTLC_SUCCESS_TX',
2024-11-15T07:15:22.0860287Z                                                   'OUR_UNILATERAL/THEIR_HTLC')
2024-11-15T07:15:22.0860662Z         assert blocks == 0
2024-11-15T07:15:22.0860908Z     
2024-11-15T07:15:22.0861262Z         # If we try to reuse the same output as we used for the anchor spend, then
2024-11-15T07:15:22.0861951Z         # bitcoind can reject it.  In that case we'll try again after we get change
2024-11-15T07:15:22.0862433Z         # from anchor spend.
2024-11-15T07:15:22.0862768Z         if txid not in bitcoind.rpc.getrawmempool():
2024-11-15T07:15:22.0863354Z             bitcoind.generate_block(1)
2024-11-15T07:15:22.0863735Z >           bitcoind.generate_block(1, wait_for_mempool=1)
2024-11-15T07:15:22.0864019Z 
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
e261301301 exposesecret: new plugin and command to get hsm_secret.
Being able to back up the hsm_secret is critical, but you cannot do
this through a UI, because of course we do not allow such access.
People have lost funds because they didn't back up.

This allows access to the hsm_secret if you use a password set in the
config file.  (If it's not set, the command does not work).  This is a
compromise, of course.

Changelog-Added: `exposesecret` command for encouraging hsm_secret backups.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 08:49:55 +10:30
Rusty Russell
fcdbbd8534 doc: improve documentation of listpays
1. It's called listpays not listpay.
2. "index" does NOT have a default value (it must be specified if limit or start are used)
3. Note that limit and start have effects on accuracy, since we combine records.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 10:43:37 +01:00
daywalker90
c4e67c0b96 add listing options to listpays
Changelog-Added: JSON-RPC: `listpays` has `index`, `start` and `limit` parameters for listing control.
2024-11-12 10:43:37 +01:00
Rusty Russell
b34adc704b pyln-testing: don't fail to start node if we have no Rust.
No cln-grpc means no "grpc-port" option!  I often test this way, with RUST=0
for speed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 09:56:39 +01:00
evansmj
edc0eb6473 bkpr: add examples for new edit description RPC calls 2024-11-12 09:46:09 +10:30
niftynei
2b4b91ff5c bkpr: add new RPC bkpr-editdescriptionbyoutpoint
Given an {outpoint}, sets the description on the matching outpoint (if exists).

Note that if no outpoint exists in bookkeeper, will return an empty list

Changleog-Added: PLUGINS: bookkeeper has a new RPC `bkrp-editdescriptionbyoutpoint` which will set/update a description for an outpoint creation event.
2024-11-12 09:46:09 +10:30