From 15e8bd5a45aa31367c89569208f3746f492beb68 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 18 Aug 2016 14:25:13 +0930 Subject: [PATCH] peer: save minimum possible depth for anchor. We'll save this in the database so we know where to start the chain from when we reload. Signed-off-by: Rusty Russell --- daemon/peer.c | 1 + daemon/peer.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/daemon/peer.c b/daemon/peer.c index 462ccd7bb..e14e37c6c 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -2001,6 +2001,7 @@ static struct peer *new_peer(struct lightningd_state *dstate, peer->local.commit = peer->remote.commit = NULL; peer->local.staging_cstate = peer->remote.staging_cstate = NULL; + peer->anchor.min_depth = get_block_height(peer->dstate); htlc_map_init(&peer->htlcs); /* FIXME: Attach IO logging for this peer. */ diff --git a/daemon/peer.h b/daemon/peer.h index 08e4f0399..3953acc42 100644 --- a/daemon/peer.h +++ b/daemon/peer.h @@ -131,6 +131,9 @@ struct peer { u64 satoshis; u8 *witnessscript; + /* Minimum possible depth for anchor */ + unsigned int min_depth; + /* If we're creating anchor, this tells us where to source it */ struct anchor_input *input;