From aba0b0e01ba869b6ae063a38bff057175da9238a Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 21 Mar 2018 23:39:21 +0100 Subject: [PATCH] opening: Add the change scriptpubkey to the txfilter This is necessary to track confirmations of or change output. Signed-off-by: Christian Decker --- lightningd/opening_control.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 783e7f464..cfa050cfa 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -371,6 +371,12 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp, /* Extract the change output and add it to the DB */ wallet_extract_owned_outputs(ld->wallet, fundingtx, NULL, &change_satoshi); + /* Make sure we recognize our change output by its scriptpubkey in + * future. This assumes that we have only two outputs, may not be true + * if we add support for multifundchannel */ + if (tal_count(fundingtx->output) == 2) + txfilter_add_scriptpubkey(ld->owned_txfilter, fundingtx->output[!funding_outnum].script); + /* Send it out and watch for confirms. */ broadcast_tx(ld->topology, channel, fundingtx, funding_broadcast_failed);