2016-01-21 21:11:47 +01:00
|
|
|
#ifndef LIGHTNING_DAEMON_LIGHTNING_H
|
|
|
|
#define LIGHTNING_DAEMON_LIGHTNING_H
|
|
|
|
#include "config.h"
|
2016-01-21 21:11:48 +01:00
|
|
|
#include "bitcoin/pubkey.h"
|
2016-01-21 21:11:49 +01:00
|
|
|
#include "watch.h"
|
2016-01-21 21:11:48 +01:00
|
|
|
#include <ccan/list/list.h>
|
2016-01-21 21:11:49 +01:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2016-01-21 21:11:48 +01:00
|
|
|
#include <ccan/timer/timer.h>
|
2016-01-21 21:11:48 +01:00
|
|
|
#include <secp256k1.h>
|
2016-01-21 21:11:47 +01:00
|
|
|
#include <stdio.h>
|
2016-01-21 21:11:47 +01:00
|
|
|
|
2016-01-21 21:11:49 +01:00
|
|
|
/* Various adjustable things. */
|
|
|
|
struct config {
|
2016-01-21 21:11:49 +01:00
|
|
|
/* Are we on testnet? */
|
|
|
|
bool testnet;
|
|
|
|
|
2016-01-21 21:11:49 +01:00
|
|
|
/* How long do we want them to lock up their funds? (seconds) */
|
|
|
|
u32 rel_locktime;
|
|
|
|
|
|
|
|
/* How long do we let them lock up our funds? (seconds) */
|
|
|
|
u32 rel_locktime_max;
|
|
|
|
|
|
|
|
/* How many confirms until we consider an anchor "settled". */
|
|
|
|
u32 anchor_confirms;
|
|
|
|
|
|
|
|
/* How long will we accept them waiting? */
|
|
|
|
u32 anchor_confirms_max;
|
|
|
|
|
|
|
|
/* What are we prepared to pay in commitment fee (satoshis). */
|
|
|
|
u64 commitment_fee;
|
|
|
|
|
|
|
|
/* How little are we prepared to have them pay? */
|
|
|
|
u64 commitment_fee_min;
|
|
|
|
};
|
|
|
|
|
2016-01-21 21:11:47 +01:00
|
|
|
/* Here's where the global variables hide! */
|
|
|
|
struct lightningd_state {
|
|
|
|
/* Where all our logging goes. */
|
|
|
|
struct log_record *log_record;
|
|
|
|
struct log *base_log;
|
2016-01-21 21:11:47 +01:00
|
|
|
FILE *logf;
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
/* Our config dir, and rpc file */
|
|
|
|
char *config_dir;
|
|
|
|
char *rpc_filename;
|
2016-01-21 21:11:48 +01:00
|
|
|
|
2016-01-21 21:11:49 +01:00
|
|
|
/* Configuration settings. */
|
|
|
|
struct config config;
|
|
|
|
|
2016-01-21 21:11:48 +01:00
|
|
|
/* Any pending timers. */
|
2016-01-21 21:11:48 +01:00
|
|
|
struct timers timers;
|
|
|
|
|
|
|
|
/* Our peers. */
|
|
|
|
struct list_head peers;
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
/* Crypto tables for global use. */
|
|
|
|
secp256k1_context *secpctx;
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
/* Our private key */
|
|
|
|
struct secret *secret;
|
|
|
|
|
|
|
|
/* This is us. */
|
|
|
|
struct pubkey id;
|
2016-01-21 21:11:49 +01:00
|
|
|
|
2016-01-21 21:11:49 +01:00
|
|
|
/* Transactions/txos we are watching. */
|
|
|
|
struct txwatch_hash txwatches;
|
|
|
|
struct txowatch_hash txowatches;
|
2016-01-21 21:11:49 +01:00
|
|
|
|
|
|
|
/* Outstanding bitcoind requests. */
|
|
|
|
struct list_head bitcoin_req;
|
|
|
|
bool bitcoin_req_running;
|
2016-01-21 21:11:47 +01:00
|
|
|
};
|
|
|
|
#endif /* LIGHTNING_DAEMON_LIGHTNING_H */
|