cln/lightningd
Rusty Russell 4d8f923a9a logging: switch to a simple ringbuffer.
We keep a history of logs internally, so we can drop them to disk on a
crash.  This "black box recorder" was some of the first code I wrote
for CLN, but I can't remember the last time we use a crash log to
diagnose a problem.

We attempt to prune it to keep it under 10MB, but the complexity
and cost is rarely worth it: simplify it to use a ringbuffer.

Changelog-Changed: lightningd: logging is now more efficient internally (no more pruning, simple ringbuffer).

```
     139993 DEBUG   lightningd: fixup_scan: block 786151 with 1203 txs
===>  55388 DEBUG   plugin-bcli: Log pruned 1001 entries (mem 10508118 -> 10298662)
      33000 DEBUG   gossipd: Unreasonable timestamp in 0102000a38ec41f9137a5a560dac6effbde059c12cb727344821cbdd4ef46964a4791a0f67cd997499a6062fc8b4284bf1b47a91541fd0e65129505f02e4d08542b16fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000d9d56000ba40001690fe262010100900000000000000001000003e8000001f30000000000989680
      23515 DEBUG   hsmd: Client: Received message 14 from client
      22269 DEBUG   024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605-hsmd: Got WIRE_HSMD_ECDH_REQ
      14409 DEBUG   gossipd: Enqueueing update for announce 0102002f7e4b4deb19947c67292e70cb22f7fac837fa9ee6269393f3c513d0431d52672e7387625856c19299cfd584e1a3f39e0f98df13c99090df9f4d5cca8446776fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000e216b0008050001692e1c390101009000000000000003e800000000000013880000004526945a00
      12534 DEBUG   gossipd: Previously-rejected announce for 514127x248x1
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Got it!
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: ... , awaiting 1120
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Sending master 1020
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
..
test logging: switch to a simple ringbuffer. 2026-01-27 09:31:02 +10:30
.gitignore Ignore all the deamon inside the git history 2021-10-28 15:51:38 +02:00
anchorspend.c lightningd: use bip86 derivation for anchor spend change outputs 2026-01-14 17:18:56 +10:30
anchorspend.h channeld: use anchors on peer's commitment(s) if we can't broadcast our own. 2023-10-27 11:19:56 +10:30
bitcoind.c lightningd: remove support for long-deprecated old-style feerate responses. 2026-01-20 19:32:42 +10:30
bitcoind.h lightningd: re-xmit funding txs on startup. 2025-11-19 07:23:39 +10:30
chaintopology.c lightningd: fix db constraint error when fixing up old blocks. 2025-12-11 12:16:42 +10:30
chaintopology.h lightningd: scan back to seek missing UTXOs. 2025-11-29 08:18:20 +10:30
channel.c lightningd: immediately close without broadcast whenever we close a withheld channel. 2025-11-19 07:23:39 +10:30
channel.h lightningd: save funding PSBT to database if we're to withhold it. 2025-11-19 07:23:39 +10:30
channel_control.c sendpsbt: update channel psbts if this is a channel PSBT. 2025-11-19 07:23:39 +10:30
channel_control.h lightningd: don't hand redundant block_height to block notifications. 2025-05-15 16:40:33 +09:30
channel_gossip.c lightningd: don't complain if gossipd tells us about dead channel on startup. 2026-01-08 22:33:19 +10:30
channel_gossip.h lightningd: don't hand redundant block_height to block notifications. 2025-05-15 16:40:33 +09:30
channel_state.h global: remove unnecessary includes from headers. 2025-10-23 06:44:04 +10:30
closed_channel.c lightningd: add withheld flag to listpeerchannels and listclosedchannels. 2025-11-19 07:23:39 +10:30
closed_channel.h lightningd: save funding PSBT to database if we're to withhold it. 2025-11-19 07:23:39 +10:30
closing_control.c lightningd: remove tx and txid fields from close response. 2026-01-20 19:32:42 +10:30
closing_control.h lightningd: make close_txs parameter to resolve_close_command const. 2024-11-25 20:23:21 +10:30
coin_mvts.c global: use clock_time in place of time_now(). 2025-11-13 21:21:29 +10:30
coin_mvts.h lightningd: migrate events from bookkeeper at startup. 2025-08-19 13:37:50 +09:30
configs.c ccan: update to get improved grab_file API, and adapt code. 2025-10-26 12:37:58 +10:30
connect_control.c connectd: remove unused flag to connect_init. 2026-01-20 19:32:42 +10:30
connect_control.h connectd: return reason, connect time to lightningd on connection results. 2025-11-12 13:58:43 +10:30
datastore.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
dual_open_control.c lightningd: remove the "listpeers.features.option_anchors_zero_fee_htlc_tx" option. 2026-01-20 19:32:42 +10:30
dual_open_control.h common: BOLT update: option_anchors_zero_fee_htlc_tx is now simply "option_anchors". 2024-06-19 15:54:24 +09:30
feerate.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
feerate.h lightningd: clean up feerate handling, deprecate old terms. 2023-04-10 07:31:12 +09:30
forwards.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
forwards.h global: remove unnecessary includes from headers. 2025-10-23 06:44:04 +10:30
gossip_control.c gossipd: don't need hsm fd any more. 2025-12-19 12:37:36 +01:00
gossip_control.h global: remove unnecessary includes from headers. 2025-10-23 06:44:04 +10:30
gossip_generation.c global: use clock_time in place of time_now(). 2025-11-13 21:21:29 +10:30
gossip_generation.h bitcoin/short_channel_id: pass by copy everywhere. 2024-03-20 13:51:48 +10:30
hsm_control.c hsmd_wire: remove hsmd_derive_bip86_key and add it to hsmd_init_reply_v4 2025-10-26 12:37:58 +10:30
hsm_control.h hsm_control: fixup! old comment 2025-10-26 12:37:58 +10:30
htlc_end.c global: use clock_time in place of time_now(). 2025-11-13 21:21:29 +10:30
htlc_end.h lightningd: Add extra_tlvs to htlc_accepted_hook 2025-08-14 18:57:05 +09:30
htlc_set.c lightningd: add invoice_amt to the htlc_accepted hook 2025-11-10 15:05:27 +10:30
htlc_set.h lightningd: add invoice_amt to the htlc_accepted hook 2025-11-10 15:05:27 +10:30
invoice.c lightningd: remove decodepay. 2026-01-20 19:32:42 +10:30
invoice.h lightningd: add override amt to invoice_check_payment 2025-11-10 15:05:27 +10:30
io_loop_with_timers.c database: pull out database code into a new module 2022-03-05 15:03:34 +10:30
io_loop_with_timers.h lightningd/io_loop_with_timers.c: Move mainloop to its own source file, have chaintopology use it. 2019-05-31 17:57:10 +02:00
jsonrpc.c jsonrpc: fix recover command for BIP86 wallets 2026-01-14 17:18:56 +10:30
jsonrpc.h lightningd: make notifications from plugins just like native ones. 2025-08-18 10:01:07 +09:30
lightningd.c logging: switch to a simple ringbuffer. 2026-01-27 09:31:02 +10:30
lightningd.h gossipd: remove --dev-gossip-time setting, we'll use CLN_DEV_SET_TIME. 2025-11-13 21:21:29 +10:30
log.c logging: switch to a simple ringbuffer. 2026-01-27 09:31:02 +10:30
log.h logging: switch to a simple ringbuffer. 2026-01-27 09:31:02 +10:30
log_status.c lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
log_status.h lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
Makefile Makefile: create a library containing common, wire and bitcoin objects. 2025-10-23 06:44:04 +10:30
memdump.c lightningd: fix bogus memleak report. 2026-01-14 15:41:45 +10:30
memdump.h lightningd: fix bogus memleak report. 2026-01-14 15:41:45 +10:30
notification.c lightningd: move log_prefix and log_entry struct definitions into log.c. 2026-01-27 09:31:02 +10:30
notification.h lightningd: move log_prefix and log_entry struct definitions into log.c. 2026-01-27 09:31:02 +10:30
offer.c lightningd: add description field to offer related responces 2025-12-19 15:28:46 -08:00
onchain_control.c lightningd: use BIP86 derivation for P2TR in HTLC rebroadcast change outputs 2026-01-14 17:18:56 +10:30
onchain_control.h onchaind: remove 'is_replay' logic 2021-12-28 04:42:42 +10:30
onion_message.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
onion_message.h common: remove support for pre v0.10.2 onionmessages. 2021-12-01 05:44:28 +10:30
opening_common.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
opening_common.h lightningd: save funding PSBT to database if we're to withhold it. 2025-11-19 07:23:39 +10:30
opening_control.c lightningd: remove the "listpeers.features.option_anchors_zero_fee_htlc_tx" option. 2026-01-20 19:32:42 +10:30
opening_control.h common: BOLT update: option_anchors_zero_fee_htlc_tx is now simply "option_anchors". 2024-06-19 15:54:24 +09:30
options.c lightningd: allow --recover / recover JSON RPC to take mnemonic. 2026-01-13 22:36:01 +10:30
options.h lightningd: allow --recover / recover JSON RPC to take mnemonic. 2026-01-13 22:36:01 +10:30
pay.c lightningd: fix error code on waitsendpay on old errors. 2026-01-08 22:33:19 +10:30
pay.h lightningd: refactor payment failed. 2024-10-27 13:57:50 +11:00
peer_control.c lightningd: remove the "listpeers.features.option_anchors_zero_fee_htlc_tx" option. 2026-01-20 19:32:42 +10:30
peer_control.h lightningd: re-xmit funding txs on startup. 2025-11-19 07:23:39 +10:30
peer_fd.c subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
peer_fd.h global: remove unnecessary includes from headers. 2025-10-23 06:44:04 +10:30
peer_htlcs.c common: add amount_msat_deduct / amount_msat_deduct_sub. 2025-11-17 10:56:18 +10:30
peer_htlcs.h lightningd: Add extra_tlvs to htlc_accepted_hook 2025-08-14 18:57:05 +09:30
ping.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
ping.h lightningd: fix race with crossover pings. 2025-08-14 17:35:39 +09:30
plugin.c lightningd: removing comment insisting plugin hooks are an array of objects, not names. 2026-01-20 19:32:42 +10:30
plugin.h lightningd: handle large numbers of command outputs gracefully. 2025-11-20 16:30:50 +10:30
plugin_control.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
plugin_control.h plugins: add command field to subcommand output. 2021-06-25 09:49:33 +09:30
plugin_hook.c lightningd: support "filters" in plugins manifest to restrict when hooks are called. 2025-11-20 16:30:50 +10:30
plugin_hook.h lightningd: support "filters" in plugins manifest to restrict when hooks are called. 2025-11-20 16:30:50 +10:30
routehint.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
routehint.h invoice: overhaul routehints to use topology.listincoming, cleanup. 2021-06-16 10:29:17 +09:30
runes.c global: use clock_time in place of time_now(). 2025-11-13 21:21:29 +10:30
runes.h runes: ensure that uniqueid is a valid number. 2023-09-12 15:19:02 +09:30
signmessage.c global: remove unnecessary includes from C files. 2025-10-23 06:44:04 +10:30
subd.c lightningd: fix occasional memleak when we detach subd from channel. 2026-01-08 22:33:19 +10:30
subd.h global: remove unnecessary includes from headers. 2025-10-23 06:44:04 +10:30
wait.c pytest: don't rely on sleep to ensure wait commands have been submitted. 2026-01-14 15:41:45 +10:30
wait.h lightningd: db infrastructure for network events. 2025-11-12 13:58:43 +10:30
watch.c ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
watch.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30