Skip to content

Commit d823c1d

Browse files
committed
f allow cases where the chan is still open and actually fail if we'll panic
1 parent 83ee09e commit d823c1d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13116,12 +13116,24 @@ where
1311613116
// panic if we attempted to claim them at this point.
1311713117
for (payment_hash, payment) in claimable_payments.iter() {
1311813118
for htlc in payment.htlcs.iter() {
13119-
if htlc.prev_hop.counterparty_node_id.is_none() {
13119+
if htlc.prev_hop.counterparty_node_id.is_some() {
13120+
continue;
13121+
}
13122+
if short_to_chan_info.get(&htlc.prev_hop.short_channel_id).is_some() {
13123+
log_error!(args.logger,
13124+
"We do not have the required information to claim a pending payment with payment hash {} reliably.\
13125+
As long as the channel for the inbound edge of the forward remains open, this may work okay, but we may panic at runtime!\
13126+
All HTLCs that were received by LDK 0.0.123 and prior must be resolved prior to upgrading to LDK 0.1\
13127+
Continuing anyway, though panics may occur!",
13128+
payment_hash,
13129+
);
13130+
} else {
1312013131
log_error!(args.logger,
1312113132
"We do not have the required information to claim a pending payment with payment hash {}.\
1312213133
All HTLCs that were received by LDK 0.0.123 and prior must be resolved prior to upgrading to LDK 0.1",
1312313134
payment_hash,
1312413135
);
13136+
return Err(DecodeError::InvalidValue);
1312513137
}
1312613138
}
1312713139
}

0 commit comments

Comments
 (0)