From d6656358b5e456586fab591ae0cb80340092f534 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 21 Jun 2017 17:26:38 +0200 Subject: [PATCH] wallet: Add bip32_base to the wallet struct Wallet should really be the container for anything bip32 related, so I'd like to slowly wean off of `ld->bip32_base` in favor of `ld->wallet->bip32_base` --- lightningd/hsm_control.c | 1 + wallet/wallet.c | 1 + wallet/wallet.h | 2 ++ 3 files changed, 4 insertions(+) diff --git a/lightningd/hsm_control.c b/lightningd/hsm_control.c index c4647f04b..9aa6558b3 100644 --- a/lightningd/hsm_control.c +++ b/lightningd/hsm_control.c @@ -26,6 +26,7 @@ static bool hsm_init_done(struct subd *hsm, const u8 *msg, const int *fds, ld->bip32_base) != WALLY_OK) errx(1, "HSM did not give unserializable BIP32 extkey"); + ld->wallet->bip32_base = ld->bip32_base; io_break(ld->hsm); return true; } diff --git a/wallet/wallet.c b/wallet/wallet.c index 3e60ea4fa..eb27b92b6 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -7,6 +7,7 @@ struct wallet *wallet_new(const tal_t *ctx, struct log *log) struct wallet *wallet = tal(ctx, struct wallet); wallet->db = db_setup(wallet); wallet->log = log; + wallet->bip32_base = NULL; if (!wallet->db) { fatal("Unable to setup the wallet database"); } diff --git a/wallet/wallet.h b/wallet/wallet.h index 91e119a27..450ce237b 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -5,10 +5,12 @@ #include "db.h" #include #include +#include struct wallet { struct db *db; struct log *log; + struct ext_key *bip32_base; }; /* Possible states for tracked outputs in the database. Not sure yet