mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-23 06:55:13 +01:00
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:
parent
64d3f3be26
commit
aef5b1b844
2 changed files with 11 additions and 11 deletions
|
@ -202,8 +202,8 @@ static void broadcast_done(struct bitcoind *bitcoind,
|
||||||
/* No longer needs to be disconnected if channel dies. */
|
/* No longer needs to be disconnected if channel dies. */
|
||||||
tal_del_destructor2(otx->channel, clear_otx_channel, otx);
|
tal_del_destructor2(otx->channel, clear_otx_channel, otx);
|
||||||
|
|
||||||
if (otx->failed_or_success) {
|
if (otx->finished) {
|
||||||
otx->failed_or_success(otx->channel, success, msg);
|
otx->finished(otx->channel, success, msg);
|
||||||
tal_free(otx);
|
tal_free(otx);
|
||||||
} else if (we_broadcast(bitcoind->ld->topology, &otx->txid)) {
|
} else if (we_broadcast(bitcoind->ld->topology, &otx->txid)) {
|
||||||
log_debug(
|
log_debug(
|
||||||
|
@ -223,9 +223,9 @@ static void broadcast_done(struct bitcoind *bitcoind,
|
||||||
void broadcast_tx(struct chain_topology *topo,
|
void broadcast_tx(struct chain_topology *topo,
|
||||||
struct channel *channel, const struct bitcoin_tx *tx,
|
struct channel *channel, const struct bitcoin_tx *tx,
|
||||||
const char *cmd_id, bool allowhighfees,
|
const char *cmd_id, bool allowhighfees,
|
||||||
void (*failed)(struct channel *channel,
|
void (*finished)(struct channel *channel,
|
||||||
bool success,
|
bool success,
|
||||||
const char *err))
|
const char *err))
|
||||||
{
|
{
|
||||||
/* Channel might vanish: topo owns it to start with. */
|
/* Channel might vanish: topo owns it to start with. */
|
||||||
struct outgoing_tx *otx = tal(topo, struct outgoing_tx);
|
struct outgoing_tx *otx = tal(topo, struct outgoing_tx);
|
||||||
|
@ -234,7 +234,7 @@ void broadcast_tx(struct chain_topology *topo,
|
||||||
otx->channel = channel;
|
otx->channel = channel;
|
||||||
bitcoin_txid(tx, &otx->txid);
|
bitcoin_txid(tx, &otx->txid);
|
||||||
otx->hextx = tal_hex(otx, rawtx);
|
otx->hextx = tal_hex(otx, rawtx);
|
||||||
otx->failed_or_success = failed;
|
otx->finished = finished;
|
||||||
if (cmd_id)
|
if (cmd_id)
|
||||||
otx->cmd_id = tal_strdup(otx, cmd_id);
|
otx->cmd_id = tal_strdup(otx, cmd_id);
|
||||||
else
|
else
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct outgoing_tx {
|
||||||
const char *hextx;
|
const char *hextx;
|
||||||
struct bitcoin_txid txid;
|
struct bitcoin_txid txid;
|
||||||
const char *cmd_id;
|
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 {
|
struct block {
|
||||||
|
@ -178,14 +178,14 @@ u32 penalty_feerate(struct chain_topology *topo);
|
||||||
* @tx: the transaction
|
* @tx: the transaction
|
||||||
* @cmd_id: the JSON command id which triggered this (or NULL).
|
* @cmd_id: the JSON command id which triggered this (or NULL).
|
||||||
* @allowhighfees: set to true to override the high-fee checks in the backend.
|
* @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,
|
void broadcast_tx(struct chain_topology *topo,
|
||||||
struct channel *channel, const struct bitcoin_tx *tx,
|
struct channel *channel, const struct bitcoin_tx *tx,
|
||||||
const char *cmd_id, bool allowhighfees,
|
const char *cmd_id, bool allowhighfees,
|
||||||
void (*failed)(struct channel *,
|
void (*finished)(struct channel *,
|
||||||
bool success,
|
bool success,
|
||||||
const char *err));
|
const char *err));
|
||||||
|
|
||||||
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
|
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
|
||||||
void setup_topology(struct chain_topology *topology,
|
void setup_topology(struct chain_topology *topology,
|
||||||
|
|
Loading…
Add table
Reference in a new issue