From ab2fac3714cbd9225b8cab79f2a0666b4018d76b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 18 Aug 2016 14:25:13 +0930 Subject: [PATCH] peer: add flag to indicate whether we created anchor. Useful for database. Signed-off-by: Rusty Russell --- daemon/peer.h | 3 +++ state.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/daemon/peer.h b/daemon/peer.h index 3bc493e54..daadeb3c7 100644 --- a/daemon/peer.h +++ b/daemon/peer.h @@ -142,6 +142,9 @@ struct peer { /* Depth to trigger anchor if still opening, or -1. */ int ok_depth; + + /* Did we create anchor? */ + bool ours; } anchor; struct { diff --git a/state.c b/state.c index 54d403cd7..4733c4644 100644 --- a/state.c +++ b/state.c @@ -104,6 +104,7 @@ enum state state(struct peer *peer, goto err_breakdown; } bitcoin_create_anchor(peer); + peer->anchor.ours = true; /* This shouldn't happen! */ if (!setup_first_commit(peer)) { @@ -128,6 +129,7 @@ enum state state(struct peer *peer, goto err_breakdown; } + peer->anchor.ours = false; if (!setup_first_commit(peer)) { err = pkt_err(peer, "Insufficient funds for fee"); peer_open_complete(peer, err->error->problem);