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>
This commit is contained in:
Christian Decker
2022-11-15 14:19:48 +01:00
parent f2291c44d6
commit c7ff3c4288

View File

@@ -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);