mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Fix crash that #127 intended to fix but did not completely fix
Introduced in #124, and found by fuzzer
This commit is contained in:
parent
a1aaea5dc2
commit
794212bb23
1 changed files with 3 additions and 3 deletions
|
@ -1133,9 +1133,6 @@ impl Channel {
|
||||||
let mut htlc_amount_msat = 0;
|
let mut htlc_amount_msat = 0;
|
||||||
for htlc in self.pending_htlcs.iter_mut() {
|
for htlc in self.pending_htlcs.iter_mut() {
|
||||||
if !htlc.outbound && htlc.payment_hash == *payment_hash_arg {
|
if !htlc.outbound && htlc.payment_hash == *payment_hash_arg {
|
||||||
if htlc_id != 0 {
|
|
||||||
panic!("Duplicate HTLC payment_hash, you probably re-used payment preimages, NEVER DO THIS!");
|
|
||||||
}
|
|
||||||
if htlc.state == HTLCState::Committed {
|
if htlc.state == HTLCState::Committed {
|
||||||
htlc.state = HTLCState::LocalRemoved;
|
htlc.state = HTLCState::LocalRemoved;
|
||||||
} else if htlc.state == HTLCState::RemoteAnnounced {
|
} else if htlc.state == HTLCState::RemoteAnnounced {
|
||||||
|
@ -1152,6 +1149,9 @@ impl Channel {
|
||||||
} else {
|
} else {
|
||||||
panic!("Have an inbound HTLC when not awaiting remote revoke that had a garbage state");
|
panic!("Have an inbound HTLC when not awaiting remote revoke that had a garbage state");
|
||||||
}
|
}
|
||||||
|
if htlc_id != 0 {
|
||||||
|
panic!("Duplicate HTLC payment_hash, you probably re-used payment preimages, NEVER DO THIS!");
|
||||||
|
}
|
||||||
htlc_id = htlc.htlc_id;
|
htlc_id = htlc.htlc_id;
|
||||||
htlc_amount_msat += htlc.amount_msat;
|
htlc_amount_msat += htlc.amount_msat;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue