mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
log: keep dstate pointer.
We need its secpctx pointer. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "bitcoin/tx.h"
|
||||
#include "controlled_time.h"
|
||||
#include "htlc.h"
|
||||
#include "lightningd.h"
|
||||
#include "log.h"
|
||||
#include "peer.h"
|
||||
#include "protobuf_convert.h"
|
||||
@@ -36,6 +37,7 @@ struct log_entry {
|
||||
struct log_record {
|
||||
size_t mem_used;
|
||||
size_t max_mem;
|
||||
struct lightningd_state *dstate;
|
||||
void (*print)(const char *prefix,
|
||||
enum log_level level,
|
||||
bool continued,
|
||||
@@ -99,16 +101,17 @@ static size_t prune_log(struct log_record *log)
|
||||
return deleted;
|
||||
}
|
||||
|
||||
struct log_record *new_log_record(const tal_t *ctx,
|
||||
struct log_record *new_log_record(struct lightningd_state *dstate,
|
||||
size_t max_mem,
|
||||
enum log_level printlevel)
|
||||
{
|
||||
struct log_record *lr = tal(ctx, struct log_record);
|
||||
struct log_record *lr = tal(dstate, struct log_record);
|
||||
|
||||
/* Give a reasonable size for memory limit! */
|
||||
assert(max_mem > sizeof(struct log) * 2);
|
||||
lr->mem_used = 0;
|
||||
lr->max_mem = max_mem;
|
||||
lr->dstate = dstate;
|
||||
lr->print = log_default_print;
|
||||
lr->print_level = printlevel;
|
||||
lr->init_time = time_now();
|
||||
|
||||
Reference in New Issue
Block a user