From 93b72332bd31d664d1ffb75566c68c848208f6c0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 7 Oct 2016 13:53:18 +1030 Subject: [PATCH] Handle anchor in a run of blocks. Fix dff50c3a5f2224592d135ad9cc6c11be89e26def: if multiple blocks come between polling, we'll get called once for the new tip. Signed-off-by: Rusty Russell --- daemon/peer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/peer.c b/daemon/peer.c index 0c21fc05c..12ccfa235 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -2961,7 +2961,8 @@ static enum watch_result anchor_depthchange(struct peer *peer, { /* Still waiting for it to reach depth? */ if (state_is_waiting_for_anchor(peer->state)) { - if ((int)depth == peer->anchor.ok_depth) { + /* We can see a run of blocks all at once, so may be > depth */ + if ((int)depth >= peer->anchor.ok_depth) { state_event(peer, BITCOIN_ANCHOR_DEPTHOK, NULL); peer->anchor.ok_depth = -1; }