txwatch: hand ld to callback, don't assume channel is non-NULL.

We're about to use the txwatch facility for UTXOs, where there's no channel,
so allow that the be NULL, and hand the struct lightningd which callers
want anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-08-13 12:35:33 +09:30
committed by Christian Decker
parent 5d23698665
commit 05f12edf60
5 changed files with 36 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ struct bitcoin_tx;
struct block;
struct channel;
struct chain_topology;
struct lightningd;
struct txowatch;
struct txwatch;
@@ -43,17 +44,19 @@ struct txwatch *watch_txid(const tal_t *ctx,
struct chain_topology *topo,
struct channel *channel,
const struct bitcoin_txid *txid,
enum watch_result (*cb)(struct channel *channel,
const struct bitcoin_txid *,
enum watch_result (*cb)(struct lightningd *ld,
struct channel *channel,
const struct bitcoin_txid *,
unsigned int depth));
struct txwatch *watch_tx(const tal_t *ctx,
struct chain_topology *topo,
struct channel *channel,
const struct bitcoin_tx *tx,
enum watch_result (*cb)(struct channel *channel,
const struct bitcoin_txid *,
unsigned int depth));
enum watch_result (*cb)(struct lightningd *ld,
struct channel *channel,
const struct bitcoin_txid *,
unsigned int depth));
struct txowatch *watch_txo(const tal_t *ctx,
struct chain_topology *topo,