Skip to content

Commit ae8f536

Browse files
committed
Include announced field in RouteHop
1 parent 758679a commit ae8f536

File tree

7 files changed

+65
-16
lines changed

7 files changed

+65
-16
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,7 @@ mod tests {
16851685
channel_features: ChannelFeatures::empty(),
16861686
fee_msat: 0,
16871687
cltv_expiry_delta: MIN_CLTV_EXPIRY_DELTA as u32,
1688+
announced: true,
16881689
}], blinded_tail: None };
16891690

16901691
$nodes[0].scorer.lock().unwrap().expect(TestResult::PaymentFailure { path: path.clone(), short_channel_id: scored_scid });

lightning/src/ln/functional_tests.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,15 +1036,17 @@ fn fake_network_test() {
10361036
short_channel_id: chan_2.0.contents.short_channel_id,
10371037
channel_features: ChannelFeatures::empty(),
10381038
fee_msat: 0,
1039-
cltv_expiry_delta: chan_3.0.contents.cltv_expiry_delta as u32
1039+
cltv_expiry_delta: chan_3.0.contents.cltv_expiry_delta as u32,
1040+
announced: true,
10401041
});
10411042
hops.push(RouteHop {
10421043
pubkey: nodes[3].node.get_our_node_id(),
10431044
node_features: NodeFeatures::empty(),
10441045
short_channel_id: chan_3.0.contents.short_channel_id,
10451046
channel_features: ChannelFeatures::empty(),
10461047
fee_msat: 0,
1047-
cltv_expiry_delta: chan_4.1.contents.cltv_expiry_delta as u32
1048+
cltv_expiry_delta: chan_4.1.contents.cltv_expiry_delta as u32,
1049+
announced: true,
10481050
});
10491051
hops.push(RouteHop {
10501052
pubkey: nodes[1].node.get_our_node_id(),
@@ -1053,6 +1055,7 @@ fn fake_network_test() {
10531055
channel_features: nodes[1].node.channel_features(),
10541056
fee_msat: 1000000,
10551057
cltv_expiry_delta: TEST_FINAL_CLTV,
1058+
announced: true,
10561059
});
10571060
hops[1].fee_msat = chan_4.1.contents.fee_base_msat as u64 + chan_4.1.contents.fee_proportional_millionths as u64 * hops[2].fee_msat as u64 / 1000000;
10581061
hops[0].fee_msat = chan_3.0.contents.fee_base_msat as u64 + chan_3.0.contents.fee_proportional_millionths as u64 * hops[1].fee_msat as u64 / 1000000;
@@ -1067,15 +1070,17 @@ fn fake_network_test() {
10671070
short_channel_id: chan_4.0.contents.short_channel_id,
10681071
channel_features: ChannelFeatures::empty(),
10691072
fee_msat: 0,
1070-
cltv_expiry_delta: chan_3.1.contents.cltv_expiry_delta as u32
1073+
cltv_expiry_delta: chan_3.1.contents.cltv_expiry_delta as u32,
1074+
announced: true,
10711075
});
10721076
hops.push(RouteHop {
10731077
pubkey: nodes[2].node.get_our_node_id(),
10741078
node_features: NodeFeatures::empty(),
10751079
short_channel_id: chan_3.0.contents.short_channel_id,
10761080
channel_features: ChannelFeatures::empty(),
10771081
fee_msat: 0,
1078-
cltv_expiry_delta: chan_2.1.contents.cltv_expiry_delta as u32
1082+
cltv_expiry_delta: chan_2.1.contents.cltv_expiry_delta as u32,
1083+
announced: true,
10791084
});
10801085
hops.push(RouteHop {
10811086
pubkey: nodes[1].node.get_our_node_id(),
@@ -1084,6 +1089,7 @@ fn fake_network_test() {
10841089
channel_features: nodes[1].node.channel_features(),
10851090
fee_msat: 1000000,
10861091
cltv_expiry_delta: TEST_FINAL_CLTV,
1092+
announced: true,
10871093
});
10881094
hops[1].fee_msat = chan_2.1.contents.fee_base_msat as u64 + chan_2.1.contents.fee_proportional_millionths as u64 * hops[2].fee_msat as u64 / 1000000;
10891095
hops[0].fee_msat = chan_3.1.contents.fee_base_msat as u64 + chan_3.1.contents.fee_proportional_millionths as u64 * hops[1].fee_msat as u64 / 1000000;

lightning/src/ln/onion_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -984,27 +984,27 @@ mod tests {
984984
RouteHop {
985985
pubkey: PublicKey::from_slice(&hex::decode("02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619").unwrap()[..]).unwrap(),
986986
channel_features: ChannelFeatures::empty(), node_features: NodeFeatures::empty(),
987-
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // We fill in the payloads manually instead of generating them from RouteHops.
987+
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, announced: false, // We fill in the payloads manually instead of generating them from RouteHops.
988988
},
989989
RouteHop {
990990
pubkey: PublicKey::from_slice(&hex::decode("0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c").unwrap()[..]).unwrap(),
991991
channel_features: ChannelFeatures::empty(), node_features: NodeFeatures::empty(),
992-
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // We fill in the payloads manually instead of generating them from RouteHops.
992+
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, announced: false, // We fill in the payloads manually instead of generating them from RouteHops.
993993
},
994994
RouteHop {
995995
pubkey: PublicKey::from_slice(&hex::decode("027f31ebc5462c1fdce1b737ecff52d37d75dea43ce11c74d25aa297165faa2007").unwrap()[..]).unwrap(),
996996
channel_features: ChannelFeatures::empty(), node_features: NodeFeatures::empty(),
997-
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // We fill in the payloads manually instead of generating them from RouteHops.
997+
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, announced: false, // We fill in the payloads manually instead of generating them from RouteHops.
998998
},
999999
RouteHop {
10001000
pubkey: PublicKey::from_slice(&hex::decode("032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991").unwrap()[..]).unwrap(),
10011001
channel_features: ChannelFeatures::empty(), node_features: NodeFeatures::empty(),
1002-
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // We fill in the payloads manually instead of generating them from RouteHops.
1002+
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, announced: false, // We fill in the payloads manually instead of generating them from RouteHops.
10031003
},
10041004
RouteHop {
10051005
pubkey: PublicKey::from_slice(&hex::decode("02edabbd16b41c8371b92ef2f04c1185b4f03b6dcd52ba9b78d9d7c89c8f221145").unwrap()[..]).unwrap(),
10061006
channel_features: ChannelFeatures::empty(), node_features: NodeFeatures::empty(),
1007-
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0 // We fill in the payloads manually instead of generating them from RouteHops.
1007+
short_channel_id: 0, fee_msat: 0, cltv_expiry_delta: 0, announced: false, // We fill in the payloads manually instead of generating them from RouteHops.
10081008
},
10091009
], blinded_tail: None }],
10101010
route_params: None,

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,7 @@ mod tests {
18531853
channel_features: ChannelFeatures::empty(),
18541854
fee_msat: 0,
18551855
cltv_expiry_delta: 0,
1856+
announced: true,
18561857
}], blinded_tail: None }],
18571858
route_params: Some(route_params.clone()),
18581859
};
@@ -2153,6 +2154,7 @@ mod tests {
21532154
channel_features: ChannelFeatures::empty(),
21542155
fee_msat: invoice.amount_msats(),
21552156
cltv_expiry_delta: 0,
2157+
announced: false,
21562158
}
21572159
],
21582160
blinded_tail: None,

lightning/src/ln/payment_tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,7 @@ fn auto_retry_partial_failure() {
22012201
channel_features: nodes[1].node.channel_features(),
22022202
fee_msat: amt_msat / 2,
22032203
cltv_expiry_delta: 100,
2204+
announced: false,
22042205
}], blinded_tail: None },
22052206
Path { hops: vec![RouteHop {
22062207
pubkey: nodes[1].node.get_our_node_id(),
@@ -2209,6 +2210,7 @@ fn auto_retry_partial_failure() {
22092210
channel_features: nodes[1].node.channel_features(),
22102211
fee_msat: amt_msat / 2,
22112212
cltv_expiry_delta: 100,
2213+
announced: false,
22122214
}], blinded_tail: None },
22132215
],
22142216
route_params: Some(route_params.clone()),
@@ -2222,6 +2224,7 @@ fn auto_retry_partial_failure() {
22222224
channel_features: nodes[1].node.channel_features(),
22232225
fee_msat: amt_msat / 4,
22242226
cltv_expiry_delta: 100,
2227+
announced: false,
22252228
}], blinded_tail: None },
22262229
Path { hops: vec![RouteHop {
22272230
pubkey: nodes[1].node.get_our_node_id(),
@@ -2230,6 +2233,7 @@ fn auto_retry_partial_failure() {
22302233
channel_features: nodes[1].node.channel_features(),
22312234
fee_msat: amt_msat / 4,
22322235
cltv_expiry_delta: 100,
2236+
announced: false,
22332237
}], blinded_tail: None },
22342238
],
22352239
route_params: Some(route_params.clone()),
@@ -2243,6 +2247,7 @@ fn auto_retry_partial_failure() {
22432247
channel_features: nodes[1].node.channel_features(),
22442248
fee_msat: amt_msat / 4,
22452249
cltv_expiry_delta: 100,
2250+
announced: false,
22462251
}], blinded_tail: None },
22472252
],
22482253
route_params: Some(route_params.clone()),
@@ -2487,6 +2492,7 @@ fn retry_multi_path_single_failed_payment() {
24872492
channel_features: nodes[1].node.channel_features(),
24882493
fee_msat: 10_000,
24892494
cltv_expiry_delta: 100,
2495+
announced: false,
24902496
}], blinded_tail: None },
24912497
Path { hops: vec![RouteHop {
24922498
pubkey: nodes[1].node.get_our_node_id(),
@@ -2495,6 +2501,7 @@ fn retry_multi_path_single_failed_payment() {
24952501
channel_features: nodes[1].node.channel_features(),
24962502
fee_msat: 100_000_001, // Our default max-HTLC-value is 10% of the channel value, which this is one more than
24972503
cltv_expiry_delta: 100,
2504+
announced: false,
24982505
}], blinded_tail: None },
24992506
],
25002507
route_params: Some(route_params.clone()),
@@ -2576,6 +2583,7 @@ fn immediate_retry_on_failure() {
25762583
channel_features: nodes[1].node.channel_features(),
25772584
fee_msat: 100_000_001, // Our default max-HTLC-value is 10% of the channel value, which this is one more than
25782585
cltv_expiry_delta: 100,
2586+
announced: false,
25792587
}], blinded_tail: None },
25802588
],
25812589
route_params: Some(RouteParameters::from_payment_params_and_value(
@@ -2662,13 +2670,15 @@ fn no_extra_retries_on_back_to_back_fail() {
26622670
channel_features: nodes[1].node.channel_features(),
26632671
fee_msat: 0, // nodes[1] will fail the payment as we don't pay its fee
26642672
cltv_expiry_delta: 100,
2673+
announced: false,
26652674
}, RouteHop {
26662675
pubkey: nodes[2].node.get_our_node_id(),
26672676
node_features: nodes[2].node.node_features(),
26682677
short_channel_id: chan_2_scid,
26692678
channel_features: nodes[2].node.channel_features(),
26702679
fee_msat: 100_000_000,
26712680
cltv_expiry_delta: 100,
2681+
announced: false,
26722682
}], blinded_tail: None },
26732683
Path { hops: vec![RouteHop {
26742684
pubkey: nodes[1].node.get_our_node_id(),
@@ -2677,13 +2687,15 @@ fn no_extra_retries_on_back_to_back_fail() {
26772687
channel_features: nodes[1].node.channel_features(),
26782688
fee_msat: 0, // nodes[1] will fail the payment as we don't pay its fee
26792689
cltv_expiry_delta: 100,
2690+
announced: false,
26802691
}, RouteHop {
26812692
pubkey: nodes[2].node.get_our_node_id(),
26822693
node_features: nodes[2].node.node_features(),
26832694
short_channel_id: chan_2_scid,
26842695
channel_features: nodes[2].node.channel_features(),
26852696
fee_msat: 100_000_000,
26862697
cltv_expiry_delta: 100,
2698+
announced: false,
26872699
}], blinded_tail: None }
26882700
],
26892701
route_params: Some(RouteParameters::from_payment_params_and_value(
@@ -2862,13 +2874,15 @@ fn test_simple_partial_retry() {
28622874
channel_features: nodes[1].node.channel_features(),
28632875
fee_msat: 0, // nodes[1] will fail the payment as we don't pay its fee
28642876
cltv_expiry_delta: 100,
2877+
announced: false,
28652878
}, RouteHop {
28662879
pubkey: nodes[2].node.get_our_node_id(),
28672880
node_features: nodes[2].node.node_features(),
28682881
short_channel_id: chan_2_scid,
28692882
channel_features: nodes[2].node.channel_features(),
28702883
fee_msat: 100_000_000,
28712884
cltv_expiry_delta: 100,
2885+
announced: false,
28722886
}], blinded_tail: None },
28732887
Path { hops: vec![RouteHop {
28742888
pubkey: nodes[1].node.get_our_node_id(),
@@ -2877,13 +2891,15 @@ fn test_simple_partial_retry() {
28772891
channel_features: nodes[1].node.channel_features(),
28782892
fee_msat: 100_000,
28792893
cltv_expiry_delta: 100,
2894+
announced: false,
28802895
}, RouteHop {
28812896
pubkey: nodes[2].node.get_our_node_id(),
28822897
node_features: nodes[2].node.node_features(),
28832898
short_channel_id: chan_2_scid,
28842899
channel_features: nodes[2].node.channel_features(),
28852900
fee_msat: 100_000_000,
28862901
cltv_expiry_delta: 100,
2902+
announced: false,
28872903
}], blinded_tail: None }
28882904
],
28892905
route_params: Some(RouteParameters::from_payment_params_and_value(
@@ -3026,13 +3042,15 @@ fn test_threaded_payment_retries() {
30263042
channel_features: nodes[1].node.channel_features(),
30273043
fee_msat: 0,
30283044
cltv_expiry_delta: 100,
3045+
announced: false,
30293046
}, RouteHop {
30303047
pubkey: nodes[3].node.get_our_node_id(),
30313048
node_features: nodes[2].node.node_features(),
30323049
short_channel_id: 42, // Set a random SCID which nodes[1] will fail as unknown
30333050
channel_features: nodes[2].node.channel_features(),
30343051
fee_msat: amt_msat / 1000,
30353052
cltv_expiry_delta: 100,
3053+
announced: false,
30363054
}], blinded_tail: None },
30373055
Path { hops: vec![RouteHop {
30383056
pubkey: nodes[2].node.get_our_node_id(),
@@ -3041,13 +3059,15 @@ fn test_threaded_payment_retries() {
30413059
channel_features: nodes[2].node.channel_features(),
30423060
fee_msat: 100_000,
30433061
cltv_expiry_delta: 100,
3062+
announced: false,
30443063
}, RouteHop {
30453064
pubkey: nodes[3].node.get_our_node_id(),
30463065
node_features: nodes[3].node.node_features(),
30473066
short_channel_id: chan_4_scid,
30483067
channel_features: nodes[3].node.channel_features(),
30493068
fee_msat: amt_msat - amt_msat / 1000,
30503069
cltv_expiry_delta: 100,
3070+
announced: false,
30513071
}], blinded_tail: None }
30523072
],
30533073
route_params: Some(RouteParameters::from_payment_params_and_value(

0 commit comments

Comments
 (0)