mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user