mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Macro-DRY HTLC back-fails for revoked remote transaction broadcast
This commit is contained in:
parent
e344b0a8fe
commit
913d56ecab
1 changed files with 11 additions and 11 deletions
|
@ -1188,22 +1188,22 @@ impl ChannelMonitor {
|
||||||
// TODO: We really should only fail backwards after our revocation claims have been
|
// TODO: We really should only fail backwards after our revocation claims have been
|
||||||
// confirmed, but we also need to do more other tracking of in-flight pre-confirm
|
// confirmed, but we also need to do more other tracking of in-flight pre-confirm
|
||||||
// on-chain claims, so we can do that at the same time.
|
// on-chain claims, so we can do that at the same time.
|
||||||
if let Storage::Local { ref current_remote_commitment_txid, ref prev_remote_commitment_txid, .. } = self.key_storage {
|
macro_rules! check_htlc_fails {
|
||||||
if let &Some(ref txid) = current_remote_commitment_txid {
|
($txid: expr, $commitment_tx: expr) => {
|
||||||
if let Some(&(_, ref latest_outpoints)) = self.remote_claimable_outpoints.get(&txid) {
|
if let Some(&(_, ref outpoints)) = self.remote_claimable_outpoints.get(&$txid) {
|
||||||
for &(ref payment_hash, ref source, _) in latest_outpoints.iter() {
|
for &(ref payment_hash, ref source, _) in outpoints.iter() {
|
||||||
log_trace!(self, "Failing HTLC with payment_hash {} from current remote commitment tx due to broadcast of revoked remote commitment transaction", log_bytes!(payment_hash.0));
|
log_trace!(self, "Failing HTLC with payment_hash {} from {} remote commitment tx due to broadcast of revoked remote commitment transaction", log_bytes!(payment_hash.0), $commitment_tx);
|
||||||
htlc_updated.push(((*source).clone(), None, payment_hash.clone()));
|
htlc_updated.push(((*source).clone(), None, payment_hash.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if let Storage::Local { ref current_remote_commitment_txid, ref prev_remote_commitment_txid, .. } = self.key_storage {
|
||||||
|
if let &Some(ref txid) = current_remote_commitment_txid {
|
||||||
|
check_htlc_fails!(txid, "current");
|
||||||
|
}
|
||||||
if let &Some(ref txid) = prev_remote_commitment_txid {
|
if let &Some(ref txid) = prev_remote_commitment_txid {
|
||||||
if let Some(&(_, ref prev_outpoint)) = self.remote_claimable_outpoints.get(&txid) {
|
check_htlc_fails!(txid, "remote");
|
||||||
for &(ref payment_hash, ref source, _) in prev_outpoint.iter() {
|
|
||||||
log_trace!(self, "Failing HTLC with payment_hash {} from previous remote commitment tx due to broadcast of revoked remote commitment transaction", log_bytes!(payment_hash.0));
|
|
||||||
htlc_updated.push(((*source).clone(), None, payment_hash.clone()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No need to check local commitment txn, symmetric HTLCSource must be present as per-htlc data on remote commitment tx
|
// No need to check local commitment txn, symmetric HTLCSource must be present as per-htlc data on remote commitment tx
|
||||||
|
|
Loading…
Add table
Reference in a new issue