From b261c5ba0b9647d61a5c5ed711343cd2adcfc46e Mon Sep 17 00:00:00 2001 From: Simon Vrouwe Date: Thu, 21 Mar 2019 11:43:11 +0200 Subject: [PATCH] chaintopology: add REORG to logline when tx watch is fired after reorg This makes clear that txwatch_fire was called with depth=0 when chain tip got removed after a reorg. And now we can test for that. --- lightningd/watch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lightningd/watch.c b/lightningd/watch.c index d4f1e4b3c..d1ee5d1f1 100644 --- a/lightningd/watch.c +++ b/lightningd/watch.c @@ -220,10 +220,12 @@ static bool txw_fire(struct txwatch *txw, else log = txw->topo->log; + /* We assume zero depth signals a reorganization */ log_debug(log, - "Got depth change %u->%u for %s", + "Got depth change %u->%u for %s%s", txw->depth, depth, - type_to_string(tmpctx, struct bitcoin_txid, &txw->txid)); + type_to_string(tmpctx, struct bitcoin_txid, &txw->txid), + depth ? "" : " REORG"); txw->depth = depth; r = txw->cb(txw->topo->bitcoind->ld, txw->channel, txid, txw->depth); switch (r) {