Skip to content

Commit f405370

Browse files
test: test that incorrect final cltv errors
1 parent 20f287f commit f405370

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11049,6 +11049,27 @@ mod tests {
1104911049
sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat)).is_ok());
1105011050
}
1105111051

11052+
#[test]
11053+
fn test_final_incorrect_cltv(){
11054+
let chanmon_cfg = create_chanmon_cfgs(1);
11055+
let node_cfg = create_node_cfgs(1, &chanmon_cfg);
11056+
let node_chanmgr = create_node_chanmgrs(1, &node_cfg, &[None]);
11057+
let node = create_network(1, &node_cfg, &node_chanmgr);
11058+
11059+
let result = node[0].node.construct_recv_pending_htlc_info(msgs::InboundOnionPayload::Receive {
11060+
amt_msat: 100,
11061+
outgoing_cltv_value: 10,
11062+
payment_metadata: None,
11063+
keysend_preimage: None,
11064+
payment_data: Some(msgs::FinalOnionHopData {
11065+
payment_secret: PaymentSecret([0; 32]), total_msat: 100,
11066+
}),
11067+
custom_tlvs: Vec::new(),
11068+
}, [0; 32], PaymentHash([0; 32]), 100, 11, None, true, None);
11069+
11070+
assert!(result.is_err());
11071+
}
11072+
1105211073
#[test]
1105311074
fn test_inbound_anchors_manual_acceptance() {
1105411075
// Tests that we properly limit inbound channels when we have the manual-channel-acceptance

0 commit comments

Comments
 (0)