Skip to content

Commit f5c7770

Browse files
committed
f use updated accountable_into_bool that unwraps option for us
1 parent 8fcd8bc commit f5c7770

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7291,7 +7291,7 @@ where
72917291
Some(phantom_shared_secret),
72927292
false,
72937293
None,
7294-
incoming_accountable,
7294+
incoming_accountable.unwrap_or(false),
72957295
current_height,
72967296
);
72977297
match create_res {
@@ -19329,7 +19329,7 @@ mod tests {
1932919329
if let Err(crate::ln::channelmanager::InboundHTLCErr { reason, .. }) =
1933019330
create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1933119331
sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
19332-
None, current_height)
19332+
false, current_height)
1933319333
{
1933419334
assert_eq!(reason, LocalHTLCFailureReason::FinalIncorrectHTLCAmount);
1933519335
} else { panic!(); }
@@ -19352,7 +19352,7 @@ mod tests {
1935219352
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1935319353
assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1935419354
sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
19355-
None, current_height).is_ok());
19355+
false, current_height).is_ok());
1935619356
}
1935719357

1935819358
#[test]
@@ -19377,7 +19377,7 @@ mod tests {
1937719377
custom_tlvs: Vec::new(),
1937819378
},
1937919379
shared_secret: SharedSecret::from_bytes([0; 32]),
19380-
}, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, None, current_height);
19380+
}, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, false, current_height);
1938119381

1938219382
// Should not return an error as this condition:
1938319383
// https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334

lightning/src/ln/onion_payment.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ pub(super) fn create_fwd_pending_htlc_info(
241241
outgoing_amt_msat: amt_to_forward,
242242
outgoing_cltv_value,
243243
skimmed_fee_msat: None,
244-
incoming_accountable: accountable_into_bool(msg.accountable),
244+
incoming_accountable: Some(accountable_into_bool(msg.accountable)),
245245
})
246246
}
247247

248248
#[rustfmt::skip]
249249
pub(super) fn create_recv_pending_htlc_info(
250250
hop_data: onion_utils::Hop, shared_secret: [u8; 32], payment_hash: PaymentHash,
251251
amt_msat: u64, cltv_expiry: u32, phantom_shared_secret: Option<[u8; 32]>, allow_underpay: bool,
252-
counterparty_skimmed_fee_msat: Option<u64>, incoming_accountable: Option<bool>, current_height: u32
252+
counterparty_skimmed_fee_msat: Option<u64>, incoming_accountable: bool, current_height: u32
253253
) -> Result<PendingHTLCInfo, InboundHTLCErr> {
254254
let (
255255
payment_data, keysend_preimage, custom_tlvs, onion_amt_msat, onion_cltv_expiry,
@@ -420,7 +420,7 @@ pub(super) fn create_recv_pending_htlc_info(
420420
outgoing_amt_msat: onion_amt_msat,
421421
outgoing_cltv_value: onion_cltv_expiry,
422422
skimmed_fee_msat: counterparty_skimmed_fee_msat,
423-
incoming_accountable,
423+
incoming_accountable: Some(incoming_accountable),
424424
})
425425
}
426426

0 commit comments

Comments
 (0)