Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
a55ce607a1
  1. 5
      lightningd/bitcoind.c
  2. 7
      lightningd/bitcoind.h
  3. 6
      lightningd/chaintopology.c
  4. 2
      lightningd/chaintopology.h
  5. 2
      lightningd/test/run-cryptomsg.c
  6. 4
      lightningd/test/run-find_my_path.c

5
lightningd/bitcoind.c

@ -543,13 +543,16 @@ void wait_for_bitcoind(struct bitcoind *bitcoind)
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);
/* Use testnet by default, change later if we want another network */
bitcoind->chainparams = chainparams_for_network("testnet");
bitcoind->datadir = NULL;
bitcoind->ld = ld;
bitcoind->log = log;
bitcoind->req_running = false;
bitcoind->shutdown = false;

7
lightningd/bitcoind.h

@ -29,6 +29,9 @@ struct bitcoind {
/* Where to do logging. */
struct log *log;
/* Main lightningd structure */
struct lightningd *ld;
/* Are we currently running a bitcoind request (it's ratelimited) */
bool req_running;
@ -46,7 +49,9 @@ struct bitcoind {
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);

6
lightningd/chaintopology.c

@ -551,9 +551,9 @@ static void destroy_outgoing_txs(struct chain_topology *topo)
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);
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->default_fee_rate = 40000;
topo->override_fee_rate = 0;
topo->bitcoind = new_bitcoind(topo, log);
topo->bitcoind = new_bitcoind(topo, ld, log);
#if DEVELOPER
topo->dev_no_broadcast = false;
#endif

2
lightningd/chaintopology.h

@ -149,7 +149,7 @@ void broadcast_tx(struct chain_topology *topo,
int exitstatus,
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,
struct timers *timers,
struct timerel poll_time, u32 first_peer_block);

2
lightningd/test/run-cryptomsg.c

@ -47,8 +47,6 @@ void dev_blackhole_fd(int fd UNNEEDED)
/* Generated stub for dev_sabotage_fd */
void dev_sabotage_fd(int fd UNNEEDED)
{ 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 */
enum dev_disconnect dev_disconnect(int pkt_type)

4
lightningd/test/run-find_my_path.c

@ -38,7 +38,7 @@ struct log_book *new_log_book(const tal_t *ctx UNNEEDED,
enum log_level printlevel UNNEEDED)
{ fprintf(stderr, "new_log_book called!\n"); abort(); }
/* 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(); }
/* Generated stub for populate_peer */
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 */
void register_opts(struct lightningd *ld UNNEEDED)
{ 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 */
void setup_color_and_alias(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "setup_color_and_alias called!\n"); abort(); }

Loading…
Cancel
Save