2017-01-10 06:07:51 +01:00
|
|
|
#ifndef LIGHTNING_LIGHTNINGD_LIGHTNINGD_H
|
|
|
|
#define LIGHTNING_LIGHTNINGD_LIGHTNINGD_H
|
|
|
|
#include "config.h"
|
2017-04-01 13:01:13 +02:00
|
|
|
#include <lightningd/htlc_end.h>
|
2019-12-12 00:55:45 +01:00
|
|
|
#include <lightningd/htlc_set.h>
|
2021-09-19 13:07:58 +02:00
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/stat.h>
|
2017-05-23 22:07:20 +02:00
|
|
|
#include <wallet/wallet.h>
|
2017-01-10 06:07:51 +01:00
|
|
|
|
2021-09-28 21:03:08 +02:00
|
|
|
struct amount_msat;
|
|
|
|
|
2017-08-28 18:04:01 +02:00
|
|
|
/* Various adjustable things. */
|
|
|
|
struct config {
|
|
|
|
/* How long do we want them to lock up their funds? (blocks) */
|
|
|
|
u32 locktime_blocks;
|
|
|
|
|
|
|
|
/* How long do we let them lock up our funds? (blocks) */
|
|
|
|
u32 locktime_max;
|
|
|
|
|
|
|
|
/* How many confirms until we consider an anchor "settled". */
|
|
|
|
u32 anchor_confirms;
|
|
|
|
|
2017-10-23 06:16:57 +02:00
|
|
|
/* Minimum CLTV to subtract from incoming HTLCs to outgoing */
|
|
|
|
u32 cltv_expiry_delta;
|
|
|
|
|
|
|
|
/* Minimum CLTV if we're the final hop.*/
|
|
|
|
u32 cltv_final;
|
|
|
|
|
2017-08-28 18:04:01 +02:00
|
|
|
/* Fee rates. */
|
|
|
|
u32 fee_base;
|
2019-02-10 22:30:38 +01:00
|
|
|
u32 fee_per_satoshi;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
2019-07-27 19:45:22 +02:00
|
|
|
/* htlcs per channel */
|
|
|
|
u32 max_concurrent_htlcs;
|
|
|
|
|
2022-03-26 14:31:26 +01:00
|
|
|
/* htlc min/max values */
|
|
|
|
struct amount_msat htlc_minimum_msat;
|
|
|
|
struct amount_msat htlc_maximum_msat;
|
|
|
|
|
2021-09-28 21:03:08 +02:00
|
|
|
/* Max amount of dust allowed per channel */
|
|
|
|
struct amount_msat max_dust_htlc_exposure_msat;
|
|
|
|
|
2017-08-28 18:04:01 +02:00
|
|
|
/* How long between changing commit and sending COMMIT message. */
|
2018-05-17 06:46:22 +02:00
|
|
|
u32 commit_time_ms;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
2019-09-09 18:11:24 +02:00
|
|
|
/* Do we let the opener set any fee rate they want */
|
2018-01-16 10:24:46 +01:00
|
|
|
bool ignore_fee_limits;
|
2018-04-18 15:23:15 +02:00
|
|
|
|
|
|
|
/* Number of blocks to rescan from the current head, or absolute
|
|
|
|
* blockheight if rescan >= 500'000 */
|
|
|
|
s32 rescan;
|
2018-05-10 01:18:19 +02:00
|
|
|
|
|
|
|
/* ipv6 bind disable */
|
|
|
|
bool no_ipv6_bind;
|
2018-06-11 19:50:37 +02:00
|
|
|
|
2018-06-20 13:11:25 +02:00
|
|
|
/* Are we allowed to use DNS lookup for peers. */
|
|
|
|
bool use_dns;
|
2019-04-03 10:20:38 +02:00
|
|
|
|
2022-03-26 14:31:26 +01:00
|
|
|
/* Turn off IP address announcement discovered via peer `remote_addr` */
|
|
|
|
bool disable_ip_discovery;
|
|
|
|
|
2019-04-03 10:20:38 +02:00
|
|
|
/* Minimal amount of effective funding_satoshis for accepting channels */
|
|
|
|
u64 min_capacity_sat;
|
2019-09-25 13:05:14 +02:00
|
|
|
|
2019-10-03 16:32:38 +02:00
|
|
|
/* This is the key we use to encrypt `hsm_secret`. */
|
|
|
|
struct secret *keypass;
|
2020-09-11 08:48:12 +02:00
|
|
|
|
|
|
|
/* How long before we give up waiting for INIT msg */
|
|
|
|
u32 connection_timeout_secs;
|
2021-01-13 09:58:38 +01:00
|
|
|
|
|
|
|
/* EXPERIMENTAL: offers support */
|
|
|
|
bool exp_offers;
|
2022-06-22 15:31:27 +02:00
|
|
|
|
|
|
|
/* Allow dust reserves (including 0) when being called via
|
|
|
|
* `fundchannel` or in the `openchannel` hook. This is a
|
|
|
|
* slight spec incompatibility, but implementations do this
|
|
|
|
* already. */
|
|
|
|
bool allowdustreserve;
|
2017-08-28 18:04:01 +02:00
|
|
|
};
|
|
|
|
|
2020-02-04 01:14:13 +01:00
|
|
|
typedef STRMAP(const char *) alt_subdaemon_map;
|
|
|
|
|
2020-02-13 21:01:23 +01:00
|
|
|
enum lightningd_state {
|
|
|
|
LD_STATE_RUNNING,
|
|
|
|
LD_STATE_SHUTDOWN,
|
|
|
|
};
|
|
|
|
|
2017-08-28 18:09:01 +02:00
|
|
|
struct lightningd {
|
|
|
|
/* The directory to find all the subdaemons. */
|
|
|
|
const char *daemon_dir;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
2019-08-01 08:20:43 +02:00
|
|
|
/* If we told to run in the background, this is our parent fd, otherwise
|
|
|
|
* -1. */
|
|
|
|
int daemon_parent_fd;
|
2018-02-16 03:00:41 +01:00
|
|
|
|
2019-11-23 02:46:40 +01:00
|
|
|
/* Our config basedir, network directory, and rpc file */
|
|
|
|
char *config_basedir, *config_netdir;
|
2018-07-24 22:32:58 +02:00
|
|
|
|
|
|
|
/* Location of the RPC socket. */
|
2017-08-28 18:04:01 +02:00
|
|
|
char *rpc_filename;
|
2020-01-24 03:20:45 +01:00
|
|
|
/* Mode of the RPC filename. */
|
|
|
|
mode_t rpc_filemode;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
2018-11-14 08:12:03 +01:00
|
|
|
/* The root of the jsonrpc interface. Can be shut down
|
|
|
|
* separately from the rest of the daemon to allow a clean
|
|
|
|
* shutdown, which frees all pending cmds in a DB
|
|
|
|
* transaction. */
|
|
|
|
struct jsonrpc *jsonrpc;
|
2018-07-24 22:32:58 +02:00
|
|
|
|
2018-07-11 05:11:09 +02:00
|
|
|
/* Configuration file name */
|
|
|
|
char *config_filename;
|
2017-08-28 18:04:01 +02:00
|
|
|
/* Configuration settings. */
|
|
|
|
struct config config;
|
|
|
|
|
2018-02-18 13:56:46 +01:00
|
|
|
/* This log_book is owned by all the struct logs */
|
2017-08-28 18:09:01 +02:00
|
|
|
struct log_book *log_book;
|
2018-02-18 13:56:46 +01:00
|
|
|
/* Log for general stuff. */
|
2017-08-28 18:09:01 +02:00
|
|
|
struct log *log;
|
2022-06-26 06:25:01 +02:00
|
|
|
const char **logfiles;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
|
|
|
/* This is us. */
|
2019-04-08 11:58:32 +02:00
|
|
|
struct node_id id;
|
2017-08-28 18:04:01 +02:00
|
|
|
|
2020-12-16 04:13:37 +01:00
|
|
|
/* The public base for our payer_id keys */
|
2022-10-17 02:35:41 +02:00
|
|
|
struct pubkey bolt12_base;
|
2020-12-16 04:13:37 +01:00
|
|
|
|
2022-11-09 03:27:04 +01:00
|
|
|
/* Secret base for our invoices */
|
|
|
|
struct secret invoicesecret_base;
|
|
|
|
|
2020-03-31 00:39:00 +02:00
|
|
|
/* Feature set we offer. */
|
2020-04-03 02:03:59 +02:00
|
|
|
struct feature_set *our_features;
|
2020-03-31 00:39:00 +02:00
|
|
|
|
2017-10-23 07:05:28 +02:00
|
|
|
/* My name is... my favorite color is... */
|
2017-11-24 14:43:31 +01:00
|
|
|
u8 *alias; /* At least 32 bytes (zero-filled) */
|
2017-10-23 07:05:28 +02:00
|
|
|
u8 *rgb; /* tal_len() == 3. */
|
|
|
|
|
2017-08-28 18:09:01 +02:00
|
|
|
/* Any pending timers. */
|
2019-06-14 05:49:23 +02:00
|
|
|
struct timers *timers;
|
2017-01-10 06:07:51 +01:00
|
|
|
|
2017-08-28 18:09:01 +02:00
|
|
|
/* Port we're listening on */
|
|
|
|
u16 portnum;
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2018-05-07 05:44:40 +02:00
|
|
|
/* Do we want to reconnect to other peers? */
|
|
|
|
bool reconnect;
|
|
|
|
|
|
|
|
/* Do we want to listen for other peers? */
|
|
|
|
bool listen;
|
|
|
|
|
2018-05-07 06:28:12 +02:00
|
|
|
/* Do we want to guess addresses to listen and announce? */
|
|
|
|
bool autolisten;
|
|
|
|
|
2018-05-07 06:29:22 +02:00
|
|
|
/* Setup: Addresses to bind/announce to the network (tal_count()) */
|
|
|
|
struct wireaddr_internal *proposed_wireaddr;
|
|
|
|
/* Setup: And the bitset for each, whether to listen, announce or both */
|
|
|
|
enum addr_listen_announce *proposed_listen_announce;
|
|
|
|
|
2022-02-23 17:58:41 +01:00
|
|
|
/* Actual bindings and announceables from gossipd */
|
2018-05-07 06:29:22 +02:00
|
|
|
struct wireaddr_internal *binding;
|
2022-02-23 17:58:41 +01:00
|
|
|
struct wireaddr *announceable;
|
2017-10-23 06:15:38 +02:00
|
|
|
|
2022-02-23 18:40:10 +01:00
|
|
|
/* unverified remote_addr as reported by recent peers */
|
|
|
|
struct wireaddr *remote_addr_v4;
|
|
|
|
struct wireaddr *remote_addr_v6;
|
|
|
|
struct node_id remote_addr_v4_peer;
|
|
|
|
struct node_id remote_addr_v6_peer;
|
|
|
|
|
2022-09-12 15:47:44 +02:00
|
|
|
/* verified discovered IPs to be used for anouncement */
|
|
|
|
struct wireaddr *discovered_ip_v4;
|
|
|
|
struct wireaddr *discovered_ip_v6;
|
|
|
|
|
2017-01-10 06:08:33 +01:00
|
|
|
/* Bearer of all my secrets. */
|
2017-06-24 08:50:23 +02:00
|
|
|
int hsm_fd;
|
2018-07-09 13:17:59 +02:00
|
|
|
struct subd *hsm;
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2018-07-24 08:18:58 +02:00
|
|
|
/* Daemon for routing */
|
|
|
|
struct subd *gossip;
|
|
|
|
|
2017-01-10 06:08:33 +01:00
|
|
|
/* Daemon looking after peers during init / before channel. */
|
2018-07-24 08:18:58 +02:00
|
|
|
struct subd *connectd;
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-01-10 06:08:33 +01:00
|
|
|
/* All peers we're tracking. */
|
|
|
|
struct list_head peers;
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
|
|
|
|
/* Outstanding connect commands. */
|
|
|
|
struct list_head connects;
|
2017-02-21 05:45:29 +01:00
|
|
|
|
2017-03-07 01:56:38 +01:00
|
|
|
/* Our chain topology. */
|
|
|
|
struct chain_topology *topology;
|
|
|
|
|
2022-01-08 14:21:29 +01:00
|
|
|
/* Blockheight (as acknowledged by gossipd) */
|
|
|
|
u32 blockheight;
|
|
|
|
|
2017-04-01 13:01:13 +02:00
|
|
|
/* HTLCs in flight. */
|
2017-06-20 07:53:03 +02:00
|
|
|
struct htlc_in_map htlcs_in;
|
|
|
|
struct htlc_out_map htlcs_out;
|
2017-04-24 14:31:26 +02:00
|
|
|
|
2019-12-12 00:55:45 +01:00
|
|
|
/* Sets of HTLCs we are holding onto for MPP. */
|
|
|
|
struct htlc_set_map htlc_sets;
|
|
|
|
|
2017-05-23 22:07:20 +02:00
|
|
|
struct wallet *wallet;
|
2017-07-10 10:31:35 +02:00
|
|
|
|
2018-03-10 07:41:45 +01:00
|
|
|
/* Outstanding waitsendpay commands. */
|
|
|
|
struct list_head waitsendpay_commands;
|
2018-03-10 08:44:28 +01:00
|
|
|
/* Outstanding sendpay commands. */
|
|
|
|
struct list_head sendpay_commands;
|
2018-04-10 08:03:15 +02:00
|
|
|
/* Outstanding close commands. */
|
|
|
|
struct list_head close_commands;
|
2018-09-11 21:57:11 +02:00
|
|
|
/* Outstanding ping commands. */
|
|
|
|
struct list_head ping_commands;
|
2022-03-22 21:26:30 +01:00
|
|
|
/* Outstanding disconnect commands. */
|
|
|
|
struct list_head disconnect_commands;
|
2018-02-02 01:55:06 +01:00
|
|
|
|
2017-08-28 18:09:01 +02:00
|
|
|
/* Maintained by invoices.c */
|
|
|
|
struct invoices *invoices;
|
|
|
|
|
2017-11-27 16:20:10 +01:00
|
|
|
/* Transaction filter matching what we're interested in */
|
|
|
|
struct txfilter *owned_txfilter;
|
|
|
|
|
2018-02-20 00:00:09 +01:00
|
|
|
/* PID file */
|
|
|
|
char *pidfile;
|
|
|
|
|
2019-06-12 02:38:55 +02:00
|
|
|
/* RPC which asked us to shutdown, if non-NULL */
|
|
|
|
struct io_conn *stop_conn;
|
|
|
|
/* RPC response to send once we've shut down. */
|
|
|
|
const char *stop_response;
|
|
|
|
|
2022-01-22 05:49:22 +01:00
|
|
|
/* All the subdaemons. */
|
|
|
|
struct list_head subds;
|
|
|
|
|
2021-07-08 04:47:03 +02:00
|
|
|
/* Used these feerates instead of whatever bcli returns (up to
|
|
|
|
* FEERATE_PENALTY). */
|
|
|
|
u32 *force_feerates;
|
|
|
|
|
2022-08-24 12:05:42 +02:00
|
|
|
/* If they force db upgrade on or off this is set. */
|
|
|
|
bool *db_upgrade_ok;
|
|
|
|
|
2022-12-08 05:32:35 +01:00
|
|
|
/* Announce names in config as DNS records (recently BOLT 7 addition) */
|
|
|
|
bool announce_dns;
|
|
|
|
|
2018-12-08 01:30:56 +01:00
|
|
|
#if DEVELOPER
|
2020-05-05 03:13:34 +02:00
|
|
|
/* If we want to debug a subdaemon/plugin. */
|
|
|
|
const char *dev_debug_subprocess;
|
|
|
|
|
2021-11-12 07:44:46 +01:00
|
|
|
/* If we have --dev-no-plugin-checksum */
|
|
|
|
bool dev_no_plugin_checksum;
|
|
|
|
|
2017-10-24 04:06:14 +02:00
|
|
|
/* If we have a --dev-disconnect file */
|
|
|
|
int dev_disconnect_fd;
|
|
|
|
|
|
|
|
/* If we have --dev-fail-on-subdaemon-fail */
|
|
|
|
bool dev_subdaemon_fail;
|
2017-12-15 11:17:54 +01:00
|
|
|
|
2018-05-07 06:29:22 +02:00
|
|
|
/* Allow and accept localhost node_announcement addresses */
|
|
|
|
bool dev_allow_localhost;
|
|
|
|
|
2019-04-08 01:51:30 +02:00
|
|
|
/* Timestamp to use for gossipd, iff non-zero */
|
|
|
|
u32 dev_gossip_time;
|
|
|
|
|
2019-09-18 03:05:05 +02:00
|
|
|
/* Speedup gossip propagation, for testing. */
|
|
|
|
bool dev_fast_gossip;
|
2019-09-26 04:00:20 +02:00
|
|
|
bool dev_fast_gossip_prune;
|
2019-09-18 03:05:05 +02:00
|
|
|
|
2022-07-23 18:21:31 +02:00
|
|
|
/* Speedup reconnect delay, for testing. */
|
|
|
|
bool dev_fast_reconnect;
|
|
|
|
|
2019-07-16 23:40:14 +02:00
|
|
|
/* This is the forced private key for the node. */
|
|
|
|
struct privkey *dev_force_privkey;
|
2019-07-16 23:41:14 +02:00
|
|
|
|
|
|
|
/* This is the forced bip32 seed for the node. */
|
|
|
|
struct secret *dev_force_bip32_seed;
|
2019-07-16 23:45:14 +02:00
|
|
|
|
|
|
|
/* These are the forced channel secrets for the node. */
|
|
|
|
struct secrets *dev_force_channel_secrets;
|
|
|
|
struct sha256 *dev_force_channel_secrets_shaseed;
|
2019-11-01 18:01:54 +01:00
|
|
|
|
|
|
|
struct channel_id *dev_force_tmp_channel_id;
|
2019-11-14 01:09:38 +01:00
|
|
|
|
|
|
|
/* For slow tests (eg protocol tests) don't die if HTLC not
|
|
|
|
* committed in 30 secs */
|
|
|
|
bool dev_no_htlc_timeout;
|
2020-07-22 14:07:22 +02:00
|
|
|
|
|
|
|
bool dev_no_version_checks;
|
2021-04-05 23:12:11 +02:00
|
|
|
|
|
|
|
/* Number of blocks we wait for a channel to get funded
|
|
|
|
* if we are the fundee. */
|
|
|
|
u32 dev_max_funding_unconfirmed;
|
2021-09-30 23:19:37 +02:00
|
|
|
|
|
|
|
/* Special switches to test onion compatibility */
|
2022-09-29 05:49:03 +02:00
|
|
|
bool dev_ignore_modern_onion;
|
2021-12-29 04:26:40 +01:00
|
|
|
|
|
|
|
/* Tell channeld to disable commits after this many. */
|
|
|
|
int dev_disable_commit;
|
2022-03-25 04:11:55 +01:00
|
|
|
|
|
|
|
/* Tell channeld not to worry about pings. */
|
|
|
|
bool dev_no_ping_timer;
|
2017-10-24 04:06:14 +02:00
|
|
|
#endif /* DEVELOPER */
|
2018-05-10 01:18:19 +02:00
|
|
|
|
|
|
|
/* tor support */
|
2018-05-10 01:18:24 +02:00
|
|
|
struct wireaddr *proxyaddr;
|
2021-08-18 12:52:21 +02:00
|
|
|
bool always_use_proxy;
|
2018-05-10 01:18:19 +02:00
|
|
|
char *tor_service_password;
|
2018-05-10 01:18:24 +02:00
|
|
|
bool pure_tor_setup;
|
2019-01-11 06:51:08 +01:00
|
|
|
|
2018-09-20 13:46:50 +02:00
|
|
|
struct plugins *plugins;
|
2019-09-02 17:48:37 +02:00
|
|
|
|
|
|
|
char *wallet_dsn;
|
2019-10-03 16:32:38 +02:00
|
|
|
|
|
|
|
bool encrypted_hsm;
|
2019-12-25 00:11:52 +01:00
|
|
|
|
|
|
|
mode_t initial_umask;
|
2019-12-26 11:19:09 +01:00
|
|
|
|
|
|
|
/* Outstanding waitblockheight commands. */
|
|
|
|
struct list_head waitblockheight_commands;
|
2020-02-04 01:14:13 +01:00
|
|
|
|
|
|
|
alt_subdaemon_map alt_subdaemons;
|
2020-02-13 21:01:23 +01:00
|
|
|
|
|
|
|
enum lightningd_state state;
|
2020-04-04 01:58:04 +02:00
|
|
|
|
|
|
|
/* Total number of coin moves we've seen, since
|
|
|
|
* coin move tracking was cool */
|
|
|
|
s64 coin_moves_count;
|
2020-07-29 10:56:42 +02:00
|
|
|
|
|
|
|
/* If non-NULL, contains the exit code to use. */
|
|
|
|
int *exit_code;
|
2020-08-05 07:30:56 +02:00
|
|
|
|
|
|
|
/* The round-robin list of channels, for use when doing MPP. */
|
2020-09-08 06:57:53 +02:00
|
|
|
u64 rr_counter;
|
2021-04-16 06:31:24 +02:00
|
|
|
|
|
|
|
/* Should we re-exec ourselves instead of just exiting? */
|
|
|
|
bool try_reexec;
|
2021-06-17 11:52:50 +02:00
|
|
|
|
|
|
|
/* Array of (even) TLV types that we should allow. This is required
|
|
|
|
* since we otherwise would outright reject them. */
|
|
|
|
u64 *accept_extra_tlv_types;
|
2021-10-18 02:13:33 +02:00
|
|
|
|
|
|
|
/* EXPERIMENTAL: websocket port if non-zero */
|
|
|
|
u16 websocket_port;
|
2017-01-10 06:07:51 +01:00
|
|
|
};
|
2017-01-10 06:08:33 +01:00
|
|
|
|
lightningd: hang up on clients if they make us run out of memory.
This happened with the 800M JSON for the MCP listchannels on the raspberry
pi, and tal calls abort() by default.
We switch to raw malloc here; we could override the error hook for
tal, but this is neater since we're doing low-level things anyway,
I tested it manually with this patch:
diff --git a/lightningd/json_stream.c b/lightningd/json_stream.c
index cec9f5771..206ba37c0 100644
--- a/lightningd/json_stream.c
+++ b/lightningd/json_stream.c
@@ -43,6 +43,14 @@ static void free_json_stream_membuf(struct json_stream *js)
free(membuf_cleanup(&js->outbuf));
}
+static void *membuf_realloc_hack(struct membuf *mb, void *rawelems,
+ size_t newsize)
+{
+ if (newsize > 1000000000)
+ return NULL;
+ return realloc(rawelems, newsize);
+}
+
struct json_stream *new_json_stream(const tal_t *ctx,
struct command *writer,
struct log *log)
@@ -53,7 +61,7 @@ struct json_stream *new_json_stream(const tal_t *ctx,
js->reader = NULL;
/* We don't use tal here, because we handle failure externally (tal
* helpfully aborts with a msg, which is usually right) */
- membuf_init(&js->outbuf, malloc(64), 64, membuf_realloc);
+ membuf_init(&js->outbuf, malloc(64), 64, membuf_realloc_hack);
tal_add_destructor(js, free_json_stream_membuf);
#if DEVELOPER
js->wrapping = tal_arr(js, jsmntype_t, 0);
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-16 21:57:17 +02:00
|
|
|
/* Turning this on allows a tal allocation to return NULL, rather than aborting.
|
|
|
|
* Use only on carefully tested code! */
|
|
|
|
extern bool tal_oom_ok;
|
|
|
|
|
2020-02-04 01:14:13 +01:00
|
|
|
/* Returns true if called with a recognized subdaemon, eg: "hsmd" */
|
|
|
|
bool is_subdaemon(const char *sdname);
|
|
|
|
|
|
|
|
/* Returns the path to the subdaemon. Considers alternate subdaemon paths. */
|
|
|
|
const char *subdaemon_path(const tal_t *ctx, const struct lightningd *ld, const char *name);
|
|
|
|
|
2018-01-03 12:05:44 +01:00
|
|
|
/* Check we can run subdaemons, and check their versions */
|
2018-09-03 02:42:27 +02:00
|
|
|
void test_subdaemons(const struct lightningd *ld);
|
2018-01-03 12:05:44 +01:00
|
|
|
|
2018-05-06 15:32:01 +02:00
|
|
|
/* Notify lightningd about new blocks. */
|
|
|
|
void notify_new_block(struct lightningd *ld, u32 block_height);
|
|
|
|
|
2020-07-29 10:56:42 +02:00
|
|
|
/* Signal a clean exit from lightningd.
|
|
|
|
* NOTE! This function **returns**.
|
|
|
|
* This just causes the main loop to exit, so you have to return
|
|
|
|
* all the way to the main loop for `lightningd` to exit.
|
|
|
|
*/
|
|
|
|
void lightningd_exit(struct lightningd *ld, int exit_code);
|
|
|
|
|
2017-01-10 06:07:51 +01:00
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_LIGHTNINGD_H */
|