From 2945b25b57db37dca31c10da34a4b1ca33d697c3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 5 Jul 2019 14:58:20 +0930 Subject: [PATCH] onchaind: don't free proposal, correctly check it's not resolved in billboard. Instead of freeing proposals, which we did in *some* places, we just set ->resolved and check that in billboard_update which didn't get it right. Signed-off-by: Rusty Russell --- onchaind/onchaind.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index b4c3c734c..4297ede3d 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -514,12 +514,10 @@ static void proposal_meets_depth(struct tracked_output *out) onchain_txtype_to_wallet_txtype(out->proposal->tx_type)))); /* Don't wait for this if we're ignoring the tiny payment. */ - if (out->proposal->tx_type == IGNORING_TINY_PAYMENT) { + if (out->proposal->tx_type == IGNORING_TINY_PAYMENT) ignore_output(out); - out->proposal = tal_free(out->proposal); - } - /* We will get a callback when it's in a block. */ + /* Otherwise we will get a callback when it's in a block. */ } static void propose_resolution(struct tracked_output *out, @@ -637,9 +635,6 @@ static bool resolved_by_proposal(struct tracked_output *out, out->resolved->depth = 0; out->resolved->tx_type = out->proposal->tx_type; - - /* Don't need proposal any more */ - out->proposal = tal_free(out->proposal); return true; } @@ -760,7 +755,7 @@ static void billboard_update(struct tracked_output **outs) /* Highest priority is to report on proposals we have */ for (size_t i = 0; i < tal_count(outs); i++) { - if (!outs[i]->proposal) + if (!outs[i]->proposal || outs[i]->resolved) continue; if (!best || prop_blockheight(outs[i]) < prop_blockheight(best)) best = outs[i];