daemon/watch: API to watch various bitcoin transactions.

This uses the functions in bitcoind to provide callbacks when various
things happen.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-01-22 06:41:49 +10:30
parent 5ec8ff91e4
commit e9237f94b1
7 changed files with 347 additions and 2 deletions

View File

@@ -121,6 +121,8 @@ static struct lightningd_state *lightningd_state(void)
list_head_init(&state->peers);
timers_init(&state->timers, time_now());
txwatch_hash_init(&state->txwatches);
txowatch_hash_init(&state->txowatches);
state->secpctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
| SECP256K1_CONTEXT_SIGN);
default_config(&state->config);
@@ -203,6 +205,9 @@ int main(int argc, char *argv[])
/* Set up node ID and private key. */
secrets_init(state);
/* Create timer to do watches. */
setup_watch_timer(state);
log_info(state->base_log, "Hello world!");
/* If io_loop returns NULL, either a timer expired, or all fds closed */