Skip to content

Commit 235d5ec

Browse files
committed
ln: add experimental accountable signal to update_add_htlc
1 parent 7f20d47 commit 235d5ec

File tree

7 files changed

+19
-0
lines changed

7 files changed

+19
-0
lines changed

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,7 @@ fn update_add_msg(
15231523
skimmed_fee_msat: None,
15241524
blinding_point,
15251525
hold_htlc: None,
1526+
accountable: None,
15261527
}
15271528
}
15281529

lightning/src/ln/channel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9639,6 +9639,7 @@ where
96399639
skimmed_fee_msat: htlc.skimmed_fee_msat,
96409640
blinding_point: htlc.blinding_point,
96419641
hold_htlc: htlc.hold_htlc,
9642+
accountable: None,
96429643
});
96439644
}
96449645
}

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,7 @@ pub fn fail_backward_pending_htlc_upon_channel_failure() {
22692269
skimmed_fee_msat: None,
22702270
blinding_point: None,
22712271
hold_htlc: None,
2272+
accountable: None,
22722273
};
22732274
nodes[0].node.handle_update_add_htlc(node_b_id, &update_add_htlc);
22742275
}

lightning/src/ln/htlc_reserve_unit_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ pub fn do_test_fee_spike_buffer(cfg: Option<UserConfig>, htlc_fails: bool) {
836836
skimmed_fee_msat: None,
837837
blinding_point: None,
838838
hold_htlc: None,
839+
accountable: None,
839840
};
840841

841842
nodes[1].node.handle_update_add_htlc(node_a_id, &msg);
@@ -1075,6 +1076,7 @@ pub fn test_chan_reserve_violation_inbound_htlc_outbound_channel() {
10751076
skimmed_fee_msat: None,
10761077
blinding_point: None,
10771078
hold_htlc: None,
1079+
accountable: None,
10781080
};
10791081

10801082
nodes[0].node.handle_update_add_htlc(node_b_id, &msg);
@@ -1259,6 +1261,7 @@ pub fn test_chan_reserve_violation_inbound_htlc_inbound_chan() {
12591261
skimmed_fee_msat: None,
12601262
blinding_point: None,
12611263
hold_htlc: None,
1264+
accountable: None,
12621265
};
12631266

12641267
nodes[1].node.handle_update_add_htlc(node_a_id, &msg);
@@ -1642,6 +1645,7 @@ pub fn test_update_add_htlc_bolt2_receiver_check_max_htlc_limit() {
16421645
skimmed_fee_msat: None,
16431646
blinding_point: None,
16441647
hold_htlc: None,
1648+
accountable: None,
16451649
};
16461650

16471651
for i in 0..50 {
@@ -2248,6 +2252,7 @@ pub fn do_test_dust_limit_fee_accounting(can_afford: bool) {
22482252
skimmed_fee_msat: None,
22492253
blinding_point: None,
22502254
hold_htlc: None,
2255+
accountable: None,
22512256
};
22522257

22532258
nodes[1].node.handle_update_add_htlc(node_a_id, &msg);

lightning/src/ln/msgs.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,13 @@ pub struct UpdateAddHTLC {
771771
///
772772
/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc
773773
pub hold_htlc: Option<()>,
774+
/// An experimental field indicating whether the receiving node's reputation would be held
775+
/// accountable for the timely resolution of the HTLC.
776+
///
777+
/// Note that this field is [`experimental`] so should not be used for forwarding decisions.
778+
///
779+
/// [`experimental`]: https://github.com/lightning/blips/blob/master/blip-0004.md
780+
pub accountable: Option<u8>,
774781
}
775782

776783
/// An [`onion message`] to be sent to or received from a peer.
@@ -3368,6 +3375,7 @@ impl_writeable_msg!(UpdateAddHTLC, {
33683375
// TODO: currently we may fail to read the `ChannelManager` if we write a new even TLV in this message
33693376
// and then downgrade. Once this is fixed, update the type here to match BOLTs PR 989.
33703377
(75537, hold_htlc, option),
3378+
(106823, accountable, option),
33713379
});
33723380

33733381
impl LengthReadable for OnionMessage {
@@ -5865,6 +5873,7 @@ mod tests {
58655873
skimmed_fee_msat: None,
58665874
blinding_point: None,
58675875
hold_htlc: None,
5876+
accountable: None,
58685877
};
58695878
let encoded_value = update_add_htlc.encode();
58705879
let target_value = <Vec<u8>>::from_hex("020202020202020202020202020202020202020202020202020202020202020200083a840000034d32144668701144760101010101010101010101010101010101010101010101010101010101010101000c89d4ff031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010202020202020202020202020202020202020202020202020202020202020202").unwrap();

lightning/src/ln/onion_payment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ mod tests {
755755
skimmed_fee_msat: None,
756756
blinding_point: None,
757757
hold_htlc: None,
758+
accountable: None,
758759
}
759760
}
760761

lightning/src/ln/payment_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5078,6 +5078,7 @@ fn peel_payment_onion_custom_tlvs() {
50785078
onion_routing_packet,
50795079
blinding_point: None,
50805080
hold_htlc: None,
5081+
accountable: None,
50815082
};
50825083
let peeled_onion = crate::ln::onion_payment::peel_payment_onion(
50835084
&update_add,

0 commit comments

Comments
 (0)