2016-04-24 12:07:13 +02:00
|
|
|
#ifndef LIGHTNING_DAEMON_CHAINTOPOLOGY_H
|
|
|
|
#define LIGHTNING_DAEMON_CHAINTOPOLOGY_H
|
|
|
|
#include "config.h"
|
2016-06-30 01:38:11 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2016-04-24 12:07:13 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2016-06-30 01:38:11 +02:00
|
|
|
struct bitcoin_tx;
|
2016-04-24 12:07:13 +02:00
|
|
|
struct lightningd_state;
|
2016-06-30 01:38:11 +02:00
|
|
|
struct peer;
|
|
|
|
struct sha256_double;
|
2016-04-24 12:07:13 +02:00
|
|
|
struct txwatch;
|
|
|
|
|
2016-04-24 12:16:32 +02:00
|
|
|
/* This is the number of blocks which would have to be mined to invalidate
|
|
|
|
* the tx. */
|
2016-05-04 08:40:37 +02:00
|
|
|
size_t get_tx_depth(struct lightningd_state *dstate,
|
|
|
|
const struct sha256_double *txid);
|
2016-04-24 12:16:32 +02:00
|
|
|
|
2016-05-04 08:36:19 +02:00
|
|
|
/* Get the mediantime of the block including this tx (must be one!) */
|
|
|
|
u32 get_tx_mediantime(struct lightningd_state *dstate,
|
|
|
|
const struct sha256_double *txid);
|
2016-04-24 12:22:35 +02:00
|
|
|
|
|
|
|
/* Get mediantime of the tip; if more than one, pick greatest time. */
|
|
|
|
u32 get_tip_mediantime(struct lightningd_state *dstate);
|
|
|
|
|
2016-06-28 23:19:21 +02:00
|
|
|
/* Get highest block number. */
|
|
|
|
u32 get_block_height(struct lightningd_state *dstate);
|
|
|
|
|
2016-05-04 08:33:10 +02:00
|
|
|
/* Broadcast a single tx, and rebroadcast as reqd (takes ownership of tx) */
|
|
|
|
void broadcast_tx(struct peer *peer, const struct bitcoin_tx *tx);
|
|
|
|
|
2016-04-24 12:07:13 +02:00
|
|
|
void setup_topology(struct lightningd_state *dstate);
|
|
|
|
|
|
|
|
#endif /* LIGHTNING_DAEMON_CRYPTOPKT_H */
|