lightning/tests
ZmnSCPxj jxPCSnmZ d4690358d9 plugins/libplugin.c: Allow freeing notification struct command *.
We always allocate a new `struct command` when we get a full JSON
object from stdin:

b2df01dc73/plugins/libplugin.c (L1229-L1233)

If it happens to be a notification, we pass the `struct command` to
the handler, and not free it ourselves:

b2df01dc73/plugins/libplugin.c (L1270-L1275)

There are only nine points in `plugins/libplugin.c` where we `tal_free`
anything, and only one of them frees a `struct command`:

b2df01dc73/plugins/libplugin.c (L224-L234)

The above function `command_complete` is not appropriate for
notification handlers; the above function sends out a response
to our stdout, which a notification handler should not do.

However, as-is, it does mean that notification handling leaks
`struct command` objects, which can be problematic if we ever
have future built-in plugins which are significantly more
dependent on notifications.

This commit changes notification handlers to return
`struct command_result *`, because possibly in the future
notification handlers may want to perform `send_outreq`, so we
might as well use our standard convention for callbacks, and
to encourage future developers to check how to properly
terminate notification handlers (and free up the
`struct command`).

We also now provide a `notification_handled` function which a
notification handler must eventually call, as well as a
`notification_handler_pending` which is just a snowclone of
`command_still_pending`.
2021-10-08 14:40:04 +10:30
..
data inflights: save the whole psbt to the database 2021-05-24 12:17:48 +09:30
fuzz cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
plugins plugins/libplugin.c: Allow freeing notification struct command *. 2021-10-08 14:40:04 +10:30
vectors pytest: Add tests for the sphinx onion generation and processing 2020-03-12 10:25:01 +10:30
benchmark.py pytest: always provide payment_secret when making payments. 2021-07-14 14:38:00 -05:00
conftest.py tests: add marker for v1/v2 channel opens 2021-05-12 11:25:41 +09:30
db.py pytest: don't copy db to query it. 2021-08-26 12:44:02 +09:30
fixtures.py pytest: add schema support for JSON responses. 2021-05-27 20:28:49 +09:30
test_closing.py closingd: add notifications for feerate ranges. 2021-09-15 18:23:30 +02:00
test_connection.py common/channel_type: wrapper for generated 'struct channel_type'. 2021-09-13 15:53:23 +02:00
test_db.py inflights: save the whole psbt to the database 2021-05-24 12:17:48 +09:30
test_gossip.py pytest: Stabilize test_addgossip 2021-09-27 17:54:50 +02:00
test_invoices.py Makefile: update spec version 2021-09-09 12:04:48 +09:30
test_misc.py lightningd: rename sendonionmessage to sendobsonionmessage. 2021-09-22 06:44:26 +09:30
test_onion.py pytest: Actually make sure that the direcory exists 2020-03-24 09:52:33 +10:30
test_opening.py tests: check that we don't re-up the leased funds when we RBF 2021-08-09 07:11:05 +09:30
test_pay.py onion_message: dev options to ignore obsolete/modern onions. 2021-10-04 11:58:31 +02:00
test_plugin.py lightningd: call shutdown plugin when we dynamic shutdown a single one. 2021-09-05 15:16:56 +02:00
test_wallet.py pytest: ensure hsmtool tests do complete writes. 2021-09-21 20:19:03 +09:30
utils.py tests: promote method to utility file 2021-08-09 07:11:05 +09:30