Commit Graph

29 Commits

Author SHA1 Message Date
Shahana Farooqui 4e5e38f4b0 tests: notification response fixes
tests: notification response fixes
2023-07-10 14:51:11 +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 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 151bc47583 JSON-RPC: getmanifest passes allow-deprecated-apis flag.
This allows plugins to choose how to present things in getmanifest.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: plugins: `getmanifest` may now include "allow-deprecated-apis" boolean flag.
Changelog-Deprecated: plugins: `getmanifest` without any parameters; plugins should accept any parameters for future use.
2020-08-11 08:43:18 +09:30
rbndg 83b78fd327 Unpacking variable for cleaner code for testing 2020-05-04 19:18:05 +02:00
rbndg 241fa00e97 plugin:added invoice creation event
New invoice_creation event triggered when an new invoice is created

Changelog-Added: plugin: New invoice_creation plugin event
2020-05-04 19:18:05 +02:00
darosior af76bce0fa pyln-client: send proper JSONRPC2 errors on failed call
Changelog-Added: pyln now sends proper error on bad calls to plugin methods

Co-Authored-By: Sergi Delgado Segura <sergi.delgado.s@gmail.com>
2020-04-11 12:17:51 +09:30
Christian Decker 3e3b05e1b2 pyln: Migrate remaining uses of the deprecated pylightning module
`pylightning` is not much more than an alias for `pyln-client`, so this
removes the need to install that as well just to run the tests.
2020-03-24 09:52:33 +10:30
Vasil Dimov 43cc2ba708 contrib: fix wrong number in comment
Changelog-None
2020-01-06 12:57:59 +01:00
darosior 05a747c5ba contrib: Make cowsay answer 'init'
__________________________________
< I was not plugin specs compliant >
 ----------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
2019-09-30 00:20:16 +00:00
Rusty Russell c2f58aec9d contrib/plugins: cowsay
___________________________________________________________________________
/ The most important plugin. Ever. Much thanks to @practicalswift and @jb55 \
\ for their improvements!                                                   /
 ---------------------------------------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-26 23:10:36 +00:00
Christian Decker 9d4148ce68 pylightning: Warn users of plugins that may break due to extra args
We recently noticed that the way we unpack the call arguments for hooks and
notifications in pylightning breaks pretty quickly once you start changing the
hook and notification params. If you add params they will not get mapped
correctly causing the plugin to error out.

This can be fixed by adding a `VAR_KEYWORD` argument to the calbacks, i.e., by
adding a single `**kwargs` argument at the end of the signature. This commit
adds a check that such a catch-all argument exists, and emits a warning if it
doesn't.

It also fixes up the plugins that we ship ourselves.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-08-05 00:19:48 +00:00
darosior 34533ead68 Plugins: Add a test for the 'invoice_payment' notfication 2019-07-25 11:19:47 +08:00
Christian Decker 2b81e02a2e plugin: Parse response for htlc_accepted hook
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-06-04 00:27:15 +00:00
Christian Decker bf53821f1a plugin: Populate the request for the htlc_accepted hook
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-06-04 00:27:15 +00:00
Christian Decker b54577041a pytest: Add a simple test for the hooks
This uses the `htlc_accepted` hook to delay payment acceptance.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-06-04 00:27:15 +00:00
Christian Decker eeecfc983c plugin: Remove autopatch argument from helloworld plugin
Suggested-by: Rusty Russell <@rustyrussell>
2019-04-30 17:56:09 -05:00
Rusty Russell 0c89fc5d70 pylightning: use different decoration for init msg.
The next patch wants to decorate the methods with a compulsory
'usage' option, which doesn't make sense for init.  So I wanted
to change the init to its own decoration.

Made-to-work-by: @cdecker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-07 20:33:50 +00:00
Christian Decker c78d7e0f95 plugin: Increase manifest timeout to 60 seconds
Valgrind seems to be slowing the pay-plugin down enough for the 10
seconds timeout to get triggered on a semi-regular basis.

Reported-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-01-20 03:06:03 +00:00
Rene Pickhardt 0321d79540 [plugin] Improved the example code to encourage usage of optional arguments (#2212)
The example code had the `plugin` argument as the last argument. this disallows arguments that have a standard value. As far as I understand the dispatching code the order of arguments does not matter since it is the name `plugin` that is relevant. Therefor I changed the order so that newbe's don't have to read the entire code and can easily add optional arguments
2019-01-02 23:16:56 +01:00
Christian Decker 25ca49c444 pytest: Add a test for the event subscription and notification
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-30 14:36:02 +01:00
Christian Decker 643480cfd8 pylightning: Migrate the test plugin to use the new wrapper
Should be a lot easier to see what happens :-)

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-15 15:04:32 +01:00
Christian Decker a304db9be2 plugin: Handle log notifications from plugins
Logs are parsed and injected into the main daemon's logs.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-13 02:36:43 +00:00
William Casarin db9e250df8 python: fix check-python errors in plugins
Fixes some lint errors with unused variables:

contrib/plugins/fail/failtimeout.py:48:5:
  F841 local variable 'e' is assigned to but never used

contrib/plugins/helloworld.py:86:5:
  F841 local variable 'e' is assigned to but never used

Signed-off-by: William Casarin <jb55@jb55.com>
2018-12-10 20:03:05 +01:00
Christian Decker be7674ed6c plugin: Added .params.configuration to init call
This tells the plugin both the `lightning-dir` as well as the
`rpc-filename` to use to talk to `lightningd`. Prior to this they'd
had to guess.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-07 17:17:53 +01:00
Christian Decker f5a3f1f0a2 plugin: Add a test for timeout and broken manifest
Both of these plugins will fail in interesting ways, and we should
still handle them correctly.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-05 23:15:59 +00:00
Christian Decker 0f72e0bce8 plugin: The example plugin can now return errors
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-02 22:55:47 +00:00
Christian Decker 1e139e412b plugin: Allow both array as well as object params in example plugin
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-12-02 22:55:47 +00:00
Christian Decker e27b2ea69b pytest: Add a test for the plugin option passthrough
Signed-off-by: Christian Decker <@cdecker>
2018-11-26 22:53:37 +00:00