mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
inflights: add checks that there's actually an inflight
This commit is contained in:
@@ -922,6 +922,12 @@ openchannel2_sign_hook_cb(struct openchannel2_psbt_payload *payload STEALS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inflight = channel_current_inflight(channel);
|
inflight = channel_current_inflight(channel);
|
||||||
|
if (!inflight) {
|
||||||
|
log_broken(channel->log,
|
||||||
|
"No current channel inflight");
|
||||||
|
msg = towire_dualopend_fail(NULL, "No current channel inflight");
|
||||||
|
goto send_msg;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check that we've got the same / correct PSBT */
|
/* Check that we've got the same / correct PSBT */
|
||||||
psbt_txid(NULL, payload->psbt, &txid, NULL);
|
psbt_txid(NULL, payload->psbt, &txid, NULL);
|
||||||
@@ -1405,6 +1411,13 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inflight = channel_current_inflight(channel);
|
inflight = channel_current_inflight(channel);
|
||||||
|
if (!inflight) {
|
||||||
|
channel_internal_error(channel,
|
||||||
|
"No inflight found for channel %s",
|
||||||
|
type_to_string(tmpctx, struct channel,
|
||||||
|
channel));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Once we've sent our sigs to the peer, we're fine
|
/* Once we've sent our sigs to the peer, we're fine
|
||||||
* to broadcast the transaction, even if they haven't
|
* to broadcast the transaction, even if they haven't
|
||||||
@@ -1730,6 +1743,14 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inflight = channel_current_inflight(channel);
|
inflight = channel_current_inflight(channel);
|
||||||
|
if (!inflight) {
|
||||||
|
channel_internal_error(channel,
|
||||||
|
"No inflight found for channel %s",
|
||||||
|
type_to_string(tmpctx, struct channel,
|
||||||
|
channel));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save that we've gotten their sigs. Sometimes
|
/* Save that we've gotten their sigs. Sometimes
|
||||||
* the peer doesn't send any sigs (no inputs), otherwise
|
* the peer doesn't send any sigs (no inputs), otherwise
|
||||||
* we could just check the PSBT was finalized */
|
* we could just check the PSBT was finalized */
|
||||||
@@ -2917,11 +2938,14 @@ void peer_restart_dualopend(struct peer *peer,
|
|||||||
&min_effective_htlc_capacity);
|
&min_effective_htlc_capacity);
|
||||||
|
|
||||||
inflight = channel_current_inflight(channel);
|
inflight = channel_current_inflight(channel);
|
||||||
|
assert(inflight);
|
||||||
|
|
||||||
/* Get the first inflight to figure out the original feerate
|
/* Get the first inflight to figure out the original feerate
|
||||||
* for this channel. It's fine if it's the same as the current */
|
* for this channel. It's fine if it's the same as the current */
|
||||||
first_inflight = list_top(&channel->inflights,
|
first_inflight = list_top(&channel->inflights,
|
||||||
struct channel_inflight,
|
struct channel_inflight,
|
||||||
list);
|
list);
|
||||||
|
assert(first_inflight);
|
||||||
msg = towire_dualopend_reinit(NULL,
|
msg = towire_dualopend_reinit(NULL,
|
||||||
chainparams,
|
chainparams,
|
||||||
peer->ld->our_features,
|
peer->ld->our_features,
|
||||||
|
|||||||
@@ -1093,7 +1093,7 @@ send_error:
|
|||||||
if (feature_negotiated(ld->our_features,
|
if (feature_negotiated(ld->our_features,
|
||||||
peer->their_features,
|
peer->their_features,
|
||||||
OPT_DUAL_FUND)) {
|
OPT_DUAL_FUND)) {
|
||||||
if (channel) {
|
if (channel && !list_empty(&channel->inflights)) {
|
||||||
assert(!channel->owner);
|
assert(!channel->owner);
|
||||||
assert(channel->state == DUALOPEND_OPEN_INIT
|
assert(channel->state == DUALOPEND_OPEN_INIT
|
||||||
|| channel->state == DUALOPEND_AWAITING_LOCKIN
|
|| channel->state == DUALOPEND_AWAITING_LOCKIN
|
||||||
|
|||||||
Reference in New Issue
Block a user