From c7ff3c4288d60a0b76a8747a197b33d04a827a6c Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 15 Nov 2022 14:19:48 +0100 Subject: [PATCH] ld: Do not blindly add rebroadcasts to outgoing_tx set The list of outgoing transactions was growing with every rebroadcast. Now we just check whether it is already in the list and don't add it anymore Changelog-Fixed: ld: Reduce identification of own transactions to not slow down over time, reducing block processing time Suggested-by: Matt Whitlock <@whitslack> --- lightningd/chaintopology.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 060789dc9..f434a3974 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -208,6 +208,13 @@ static void broadcast_done(struct bitcoind *bitcoind, if (otx->failed_or_success) { otx->failed_or_success(otx->channel, success, msg); tal_free(otx); + } else if (we_broadcast(bitcoind->ld->topology, &otx->txid)) { + log_debug( + bitcoind->ld->topology->log, + "Not adding %s to list of outgoing transactions, already " + "present", + type_to_string(tmpctx, struct bitcoin_txid, &otx->txid)); + tal_free(otx); } else { /* For continual rebroadcasting, until channel freed. */ tal_steal(otx->channel, otx);