mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
lightningd: make dualopen_tell_depth match channeld_tell_depth.
Rename slightly, remove first arg, and make it a noop of there's no owner on channel. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
328d685a2a
commit
c0ffb17661
3 changed files with 18 additions and 12 deletions
|
@ -1599,7 +1599,7 @@ bool channel_tell_depth(struct lightningd *ld,
|
|||
case DUALOPEND_AWAITING_LOCKIN:
|
||||
log_debug(channel->log,
|
||||
"Funding tx %s confirmed, telling peer", txidstr);
|
||||
dualopen_tell_depth(channel->owner, channel,
|
||||
dualopend_tell_depth(channel,
|
||||
txid, depth);
|
||||
/* We're done, don't track depth any more. */
|
||||
return true;
|
||||
|
|
|
@ -1824,16 +1824,23 @@ static void handle_channel_locked(struct subd *dualopend,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dualopen_tell_depth(struct subd *dualopend,
|
||||
struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth)
|
||||
void dualopend_tell_depth(struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth)
|
||||
{
|
||||
const u8 *msg;
|
||||
u32 to_go;
|
||||
|
||||
if (!channel->owner) {
|
||||
log_debug(channel->log,
|
||||
"Funding tx %s confirmed, but peer disconnected",
|
||||
type_to_string(tmpctx, struct bitcoin_txid, txid));
|
||||
return;
|
||||
}
|
||||
|
||||
log_debug(channel->log,
|
||||
"Funding tx %s confirmed, telling peer",
|
||||
type_to_string(tmpctx, struct bitcoin_txid, txid));
|
||||
if (depth < channel->minimum_depth) {
|
||||
to_go = channel->minimum_depth - depth;
|
||||
} else
|
||||
|
@ -1851,7 +1858,7 @@ void dualopen_tell_depth(struct subd *dualopend,
|
|||
to_go));
|
||||
|
||||
msg = towire_dualopend_depth_reached(NULL, depth);
|
||||
subd_send_msg(dualopend, take(msg));
|
||||
subd_send_msg(channel->owner, take(msg));
|
||||
} else
|
||||
channel_set_billboard(channel, false,
|
||||
tal_fmt(tmpctx, "Funding needs %d more"
|
||||
|
|
|
@ -14,10 +14,9 @@ bool peer_restart_dualopend(struct peer *peer,
|
|||
struct channel *channel,
|
||||
bool from_abort);
|
||||
|
||||
void dualopen_tell_depth(struct subd *dualopend,
|
||||
struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth);
|
||||
void dualopend_tell_depth(struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth);
|
||||
|
||||
/* Close connection to an unsaved channel */
|
||||
void channel_unsaved_close_conn(struct channel *channel, const char *why);
|
||||
|
|
Loading…
Add table
Reference in a new issue