You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DRY HTLC failure code in check_spend_counterparty_transaction
This extracts the HTLC-not-in-broadcasted-commitment-transaction
code from check_spend_counterparty_transaction and moves it to a
global macro, DRYing up the two very similar codepaths (fixing
some minor logging inconsistencies) in the process.
This macro will be used for local commitment transaction HTLC
failure as well in the next commit.
This commit has no functional change outside of logging.
log_trace!($logger,"Failing HTLC with payment_hash {} from {} counterparty commitment tx due to broadcast of {} commitment transaction, waiting for confirmation (at height {})",
log_info!(logger,"Failing HTLC with payment_hash {} from {} counterparty commitment tx due to broadcast of revoked counterparty commitment transaction, waiting for confirmation (at height {})", log_bytes!(htlc.payment_hash.0), $commitment_tx, entry.confirmation_threshold());
$id:for&(ref htlc, ref source_option) in latest_outpoints.iter(){
1618
-
iflet&Some(ref source) = source_option {
1619
-
// Check if the HTLC is present in the commitment transaction that was
1620
-
// broadcast, but not if it was below the dust limit, which we should
1621
-
// fail backwards immediately as there is no way for us to learn the
1622
-
// payment_preimage.
1623
-
// Note that if the dust limit were allowed to change between
1624
-
// commitment transactions we'd want to be check whether *any*
1625
-
// broadcastable commitment transaction has the HTLC in it, but it
1626
-
// cannot currently change after channel initialization, so we don't
1627
-
// need to here.
1628
-
for&(ref broadcast_htlc, ref broadcast_source) in per_commitment_data.iter(){
1629
-
if broadcast_htlc.transaction_output_index.is_some() && Some(source) == broadcast_source.as_ref(){
1630
-
continue $id;
1631
-
}
1632
-
}
1633
-
log_trace!(logger,"Failing HTLC with payment_hash {} from {} counterparty commitment tx due to broadcast of counterparty commitment transaction", log_bytes!(htlc.payment_hash.0), $commitment_tx);
0 commit comments