Skip to content

Commit be18acd

Browse files
committed
f remove unused var and expect tx info
1 parent 8d39fd5 commit be18acd

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,7 +3065,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
30653065
};
30663066

30673067
macro_rules! walk_htlcs {
3068-
($holder_commitment: expr, $htlc_iter: expr) => {
3068+
($htlc_iter: expr) => {
30693069
let mut walk_candidate_htlcs = |htlcs| {
30703070
for &(ref candidate_htlc, ref candidate_source) in htlcs {
30713071
let candidate_htlc: &HTLCOutputInCommitment = &candidate_htlc;
@@ -3108,14 +3108,12 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
31083108
// We walk the set of HTLCs in the unrevoked counterparty commitment transactions (see
31093109
// `fail_unbroadcast_htlcs` for a description of why).
31103110
if let Some(ref txid) = us.funding.current_counterparty_commitment_txid {
3111-
if let Some(htlcs) = us.funding.counterparty_claimable_outpoints.get(txid) {
3112-
walk_candidate_htlcs(htlcs);
3113-
}
3111+
let htlcs = us.funding.counterparty_claimable_outpoints.get(txid);
3112+
walk_candidate_htlcs(htlcs.expect("Missing tx info for latest tx"));
31143113
}
31153114
if let Some(ref txid) = us.funding.prev_counterparty_commitment_txid {
3116-
if let Some(htlcs) = us.funding.counterparty_claimable_outpoints.get(txid) {
3117-
walk_candidate_htlcs(htlcs);
3118-
}
3115+
let htlcs = us.funding.counterparty_claimable_outpoints.get(txid);
3116+
walk_candidate_htlcs(htlcs.expect("Missing tx info for previous tx"));
31193117
}
31203118
};
31213119
}
@@ -3127,7 +3125,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
31273125
{
31283126
let htlcs = funding.counterparty_claimable_outpoints.get(&confirmed_txid).unwrap();
31293127
walk_htlcs!(
3130-
false,
31313128
htlcs.iter().filter_map(|(a, b)| {
31323129
if let &Some(ref source) = b {
31333130
Some((a, Some(&**source)))
@@ -3137,17 +3134,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
31373134
})
31383135
);
31393136
} else if confirmed_txid == funding.current_holder_commitment_tx.trust().txid() {
3140-
walk_htlcs!(true, holder_commitment_htlcs!(us, CURRENT_WITH_SOURCES));
3137+
walk_htlcs!(holder_commitment_htlcs!(us, CURRENT_WITH_SOURCES));
31413138
} else if let Some(prev_commitment_tx) = &funding.prev_holder_commitment_tx {
31423139
if confirmed_txid == prev_commitment_tx.trust().txid() {
3143-
walk_htlcs!(true, holder_commitment_htlcs!(us, PREV_WITH_SOURCES).unwrap());
3140+
walk_htlcs!(holder_commitment_htlcs!(us, PREV_WITH_SOURCES).unwrap());
31443141
} else {
31453142
let htlcs_confirmed: &[(&HTLCOutputInCommitment, _)] = &[];
3146-
walk_htlcs!(false, htlcs_confirmed.iter());
3143+
walk_htlcs!(htlcs_confirmed.iter());
31473144
}
31483145
} else {
31493146
let htlcs_confirmed: &[(&HTLCOutputInCommitment, _)] = &[];
3150-
walk_htlcs!(false, htlcs_confirmed.iter());
3147+
walk_htlcs!(htlcs_confirmed.iter());
31513148
}
31523149

31533150
res

0 commit comments

Comments
 (0)