mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
bitcoind: contain ld pointer.
This is a subset of a "bitcoind: wrap callbacks in transaction." from the everything-in-transaction branch, but we need the ld pointer now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -543,13 +543,16 @@ void wait_for_bitcoind(struct bitcoind *bitcoind)
|
|||||||
tal_free(cmd);
|
tal_free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bitcoind *new_bitcoind(const tal_t *ctx, struct log *log)
|
struct bitcoind *new_bitcoind(const tal_t *ctx,
|
||||||
|
struct lightningd *ld,
|
||||||
|
struct log *log)
|
||||||
{
|
{
|
||||||
struct bitcoind *bitcoind = tal(ctx, struct bitcoind);
|
struct bitcoind *bitcoind = tal(ctx, struct bitcoind);
|
||||||
|
|
||||||
/* Use testnet by default, change later if we want another network */
|
/* Use testnet by default, change later if we want another network */
|
||||||
bitcoind->chainparams = chainparams_for_network("testnet");
|
bitcoind->chainparams = chainparams_for_network("testnet");
|
||||||
bitcoind->datadir = NULL;
|
bitcoind->datadir = NULL;
|
||||||
|
bitcoind->ld = ld;
|
||||||
bitcoind->log = log;
|
bitcoind->log = log;
|
||||||
bitcoind->req_running = false;
|
bitcoind->req_running = false;
|
||||||
bitcoind->shutdown = false;
|
bitcoind->shutdown = false;
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ struct bitcoind {
|
|||||||
/* Where to do logging. */
|
/* Where to do logging. */
|
||||||
struct log *log;
|
struct log *log;
|
||||||
|
|
||||||
|
/* Main lightningd structure */
|
||||||
|
struct lightningd *ld;
|
||||||
|
|
||||||
/* Are we currently running a bitcoind request (it's ratelimited) */
|
/* Are we currently running a bitcoind request (it's ratelimited) */
|
||||||
bool req_running;
|
bool req_running;
|
||||||
|
|
||||||
@@ -46,7 +49,9 @@ struct bitcoind {
|
|||||||
bool shutdown;
|
bool shutdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bitcoind *new_bitcoind(const tal_t *ctx, struct log *log);
|
struct bitcoind *new_bitcoind(const tal_t *ctx,
|
||||||
|
struct lightningd *ld,
|
||||||
|
struct log *log);
|
||||||
|
|
||||||
void wait_for_bitcoind(struct bitcoind *bitcoind);
|
void wait_for_bitcoind(struct bitcoind *bitcoind);
|
||||||
|
|
||||||
|
|||||||
@@ -551,9 +551,9 @@ static void destroy_outgoing_txs(struct chain_topology *topo)
|
|||||||
tal_free(otx);
|
tal_free(otx);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct chain_topology *new_topology(const tal_t *ctx, struct log *log)
|
struct chain_topology *new_topology(struct lightningd *ld, struct log *log)
|
||||||
{
|
{
|
||||||
struct chain_topology *topo = tal(ctx, struct chain_topology);
|
struct chain_topology *topo = tal(ld, struct chain_topology);
|
||||||
|
|
||||||
block_map_init(&topo->block_map);
|
block_map_init(&topo->block_map);
|
||||||
list_head_init(&topo->outgoing_txs);
|
list_head_init(&topo->outgoing_txs);
|
||||||
@@ -562,7 +562,7 @@ struct chain_topology *new_topology(const tal_t *ctx, struct log *log)
|
|||||||
topo->log = log;
|
topo->log = log;
|
||||||
topo->default_fee_rate = 40000;
|
topo->default_fee_rate = 40000;
|
||||||
topo->override_fee_rate = 0;
|
topo->override_fee_rate = 0;
|
||||||
topo->bitcoind = new_bitcoind(topo, log);
|
topo->bitcoind = new_bitcoind(topo, ld, log);
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
topo->dev_no_broadcast = false;
|
topo->dev_no_broadcast = false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void broadcast_tx(struct chain_topology *topo,
|
|||||||
int exitstatus,
|
int exitstatus,
|
||||||
const char *err));
|
const char *err));
|
||||||
|
|
||||||
struct chain_topology *new_topology(const tal_t *ctx, struct log *log);
|
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
|
||||||
void setup_topology(struct chain_topology *topology,
|
void setup_topology(struct chain_topology *topology,
|
||||||
struct timers *timers,
|
struct timers *timers,
|
||||||
struct timerel poll_time, u32 first_peer_block);
|
struct timerel poll_time, u32 first_peer_block);
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ void dev_blackhole_fd(int fd UNNEEDED)
|
|||||||
/* Generated stub for dev_sabotage_fd */
|
/* Generated stub for dev_sabotage_fd */
|
||||||
void dev_sabotage_fd(int fd UNNEEDED)
|
void dev_sabotage_fd(int fd UNNEEDED)
|
||||||
{ fprintf(stderr, "dev_sabotage_fd called!\n"); abort(); }
|
{ fprintf(stderr, "dev_sabotage_fd called!\n"); abort(); }
|
||||||
/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_parse_compact */
|
|
||||||
/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_serialize_compact */
|
|
||||||
/* AUTOGENERATED MOCKS END */
|
/* AUTOGENERATED MOCKS END */
|
||||||
|
|
||||||
enum dev_disconnect dev_disconnect(int pkt_type)
|
enum dev_disconnect dev_disconnect(int pkt_type)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct log_book *new_log_book(const tal_t *ctx UNNEEDED,
|
|||||||
enum log_level printlevel UNNEEDED)
|
enum log_level printlevel UNNEEDED)
|
||||||
{ fprintf(stderr, "new_log_book called!\n"); abort(); }
|
{ fprintf(stderr, "new_log_book called!\n"); abort(); }
|
||||||
/* Generated stub for new_topology */
|
/* Generated stub for new_topology */
|
||||||
struct chain_topology *new_topology(const tal_t *ctx UNNEEDED, struct log *log UNNEEDED)
|
struct chain_topology *new_topology(struct lightningd *ld UNNEEDED, struct log *log UNNEEDED)
|
||||||
{ fprintf(stderr, "new_topology called!\n"); abort(); }
|
{ fprintf(stderr, "new_topology called!\n"); abort(); }
|
||||||
/* Generated stub for populate_peer */
|
/* Generated stub for populate_peer */
|
||||||
void populate_peer(struct lightningd *ld UNNEEDED, struct peer *peer UNNEEDED)
|
void populate_peer(struct lightningd *ld UNNEEDED, struct peer *peer UNNEEDED)
|
||||||
@@ -46,8 +46,6 @@ void populate_peer(struct lightningd *ld UNNEEDED, struct peer *peer UNNEEDED)
|
|||||||
/* Generated stub for register_opts */
|
/* Generated stub for register_opts */
|
||||||
void register_opts(struct lightningd *ld UNNEEDED)
|
void register_opts(struct lightningd *ld UNNEEDED)
|
||||||
{ fprintf(stderr, "register_opts called!\n"); abort(); }
|
{ fprintf(stderr, "register_opts called!\n"); abort(); }
|
||||||
/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_parse_compact */
|
|
||||||
/* Could not find declaration for secp256k1_ecdsa_recoverable_signature_serialize_compact */
|
|
||||||
/* Generated stub for setup_color_and_alias */
|
/* Generated stub for setup_color_and_alias */
|
||||||
void setup_color_and_alias(struct lightningd *ld UNNEEDED)
|
void setup_color_and_alias(struct lightningd *ld UNNEEDED)
|
||||||
{ fprintf(stderr, "setup_color_and_alias called!\n"); abort(); }
|
{ fprintf(stderr, "setup_color_and_alias called!\n"); abort(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user