chaintopology: rename broadcast_tx callback name.

It was once only called on failure, now it's always called (if set).
It was called different things in different places, so unify it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-03-23 16:12:52 +10:30
parent 64d3f3be26
commit aef5b1b844
2 changed files with 11 additions and 11 deletions

View file

@ -202,8 +202,8 @@ static void broadcast_done(struct bitcoind *bitcoind,
/* No longer needs to be disconnected if channel dies. */
tal_del_destructor2(otx->channel, clear_otx_channel, otx);
if (otx->failed_or_success) {
otx->failed_or_success(otx->channel, success, msg);
if (otx->finished) {
otx->finished(otx->channel, success, msg);
tal_free(otx);
} else if (we_broadcast(bitcoind->ld->topology, &otx->txid)) {
log_debug(
@ -223,9 +223,9 @@ static void broadcast_done(struct bitcoind *bitcoind,
void broadcast_tx(struct chain_topology *topo,
struct channel *channel, const struct bitcoin_tx *tx,
const char *cmd_id, bool allowhighfees,
void (*failed)(struct channel *channel,
bool success,
const char *err))
void (*finished)(struct channel *channel,
bool success,
const char *err))
{
/* Channel might vanish: topo owns it to start with. */
struct outgoing_tx *otx = tal(topo, struct outgoing_tx);
@ -234,7 +234,7 @@ void broadcast_tx(struct chain_topology *topo,
otx->channel = channel;
bitcoin_txid(tx, &otx->txid);
otx->hextx = tal_hex(otx, rawtx);
otx->failed_or_success = failed;
otx->finished = finished;
if (cmd_id)
otx->cmd_id = tal_strdup(otx, cmd_id);
else

View file

@ -22,7 +22,7 @@ struct outgoing_tx {
const char *hextx;
struct bitcoin_txid txid;
const char *cmd_id;
void (*failed_or_success)(struct channel *channel, bool success, const char *err);
void (*finished)(struct channel *channel, bool success, const char *err);
};
struct block {
@ -178,14 +178,14 @@ u32 penalty_feerate(struct chain_topology *topo);
* @tx: the transaction
* @cmd_id: the JSON command id which triggered this (or NULL).
* @allowhighfees: set to true to override the high-fee checks in the backend.
* @failed: if non-NULL, call that and don't rebroadcast.
* @finished: if non-NULL, call that and don't rebroadcast.
*/
void broadcast_tx(struct chain_topology *topo,
struct channel *channel, const struct bitcoin_tx *tx,
const char *cmd_id, bool allowhighfees,
void (*failed)(struct channel *,
bool success,
const char *err));
void (*finished)(struct channel *,
bool success,
const char *err));
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
void setup_topology(struct chain_topology *topology,