Browse Source

daemon: add global secp256k1 context for easy access.

This caches the tables, so you're not supposed to regenerate it all
the time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
14cbcd467f
  1. 2
      daemon/lightningd.c
  2. 4
      daemon/lightningd.h

2
daemon/lightningd.c

@ -29,6 +29,8 @@ static struct lightningd_state *lightningd_state(void)
list_head_init(&state->peers);
timers_init(&state->timers, time_now());
state->secpctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
| SECP256K1_CONTEXT_SIGN);
return state;
}

4
daemon/lightningd.h

@ -3,6 +3,7 @@
#include "config.h"
#include <ccan/list/list.h>
#include <ccan/timer/timer.h>
#include <secp256k1.h>
#include <stdio.h>
/* Here's where the global variables hide! */
@ -21,5 +22,8 @@ struct lightningd_state {
/* Our peers. */
struct list_head peers;
/* Crypto tables for global use. */
secp256k1_context *secpctx;
};
#endif /* LIGHTNING_DAEMON_LIGHTNING_H */

Loading…
Cancel
Save