From 3754e283f868385a5803b76c5355a7def5cc7676 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 7 Apr 2023 14:30:01 +0930 Subject: [PATCH] lightningd: remember if they set "allowhighfees" when we rebroadcast. We would only set it the first time, which was OK for how we were using it before. Now we want to also set it for rebroadcast. Signed-off-by: Rusty Russell --- lightningd/chaintopology.c | 8 +++++++- lightningd/chaintopology.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index d9c76e477..916ee4550 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -122,6 +122,9 @@ struct txs_to_broadcast { /* IDs to attach to each tx (could be NULL!) */ const char **cmd_id; + + /* allowhighfees flags for each tx */ + bool *allowhighfees; }; /* We just sent the last entry in txs[]. Shrink and send the next last. */ @@ -143,7 +146,7 @@ static void broadcast_remainder(struct bitcoind *bitcoind, /* Broadcast next one. */ bitcoind_sendrawtx(bitcoind, txs->cmd_id[txs->cursor], txs->txs[txs->cursor], - false, + txs->allowhighfees[txs->cursor], broadcast_remainder, txs); } @@ -162,6 +165,7 @@ static void rebroadcast_txs(struct chain_topology *topo) /* Put any txs we want to broadcast in ->txs. */ txs->txs = tal_arr(txs, const char *, 0); + txs->allowhighfees = tal_arr(txs, bool, 0); for (otx = outgoing_tx_map_first(topo->outgoing_txs, &it); otx; otx = outgoing_tx_map_next(topo->outgoing_txs, &it)) { @@ -181,6 +185,7 @@ static void rebroadcast_txs(struct chain_topology *topo) } tal_arr_expand(&txs->txs, fmt_bitcoin_tx(txs->txs, otx->tx)); + tal_arr_expand(&txs->allowhighfees, otx->allowhighfees); tal_arr_expand(&txs->cmd_id, otx->cmd_id ? tal_strdup(txs, otx->cmd_id) : NULL); } @@ -252,6 +257,7 @@ void broadcast_tx_(struct chain_topology *topo, bitcoin_txid(tx, &otx->txid); otx->tx = clone_bitcoin_tx(otx, tx); otx->minblock = minblock; + otx->allowhighfees = allowhighfees; otx->finished = finished; otx->refresh = refresh; otx->refresh_arg = refresh_arg; diff --git a/lightningd/chaintopology.h b/lightningd/chaintopology.h index a90b50c23..faddc4916 100644 --- a/lightningd/chaintopology.h +++ b/lightningd/chaintopology.h @@ -22,6 +22,7 @@ struct outgoing_tx { const struct bitcoin_tx *tx; struct bitcoin_txid txid; u32 minblock; + bool allowhighfees; const char *cmd_id; void (*finished)(struct channel *channel, bool success, const char *err); bool (*refresh)(struct channel *, const struct bitcoin_tx **, void *arg);