@@ -2261,6 +2261,9 @@ where
2261
2261
/// keeping additional state.
2262
2262
probing_cookie_secret: [u8; 32],
2263
2263
2264
+ /// When generating [`PaymentId`]s for inbound payments, we HMAC the HTLCs with this secret.
2265
+ inbound_payment_id_secret: [u8; 32],
2266
+
2264
2267
/// The highest block timestamp we've seen, which is usually a good guess at the current time.
2265
2268
/// Assuming most miners are generating blocks with reasonable timestamps, this shouldn't be
2266
2269
/// very far in the past, and can only ever be up to two hours in the future.
@@ -3152,6 +3155,7 @@ where
3152
3155
fake_scid_rand_bytes: entropy_source.get_secure_random_bytes(),
3153
3156
3154
3157
probing_cookie_secret: entropy_source.get_secure_random_bytes(),
3158
+ inbound_payment_id_secret: entropy_source.get_secure_random_bytes(),
3155
3159
3156
3160
highest_seen_timestamp: AtomicUsize::new(current_timestamp as usize),
3157
3161
@@ -12381,6 +12385,7 @@ where
12381
12385
let mut events_override = None;
12382
12386
let mut in_flight_monitor_updates: Option<HashMap<(PublicKey, OutPoint), Vec<ChannelMonitorUpdate>>> = None;
12383
12387
let mut decode_update_add_htlcs: Option<HashMap<u64, Vec<msgs::UpdateAddHTLC>>> = None;
12388
+ let mut inbound_payment_id_secret = None;
12384
12389
read_tlv_fields!(reader, {
12385
12390
(1, pending_outbound_payments_no_retry, option),
12386
12391
(2, pending_intercepted_htlcs, option),
@@ -12395,6 +12400,7 @@ where
12395
12400
(11, probing_cookie_secret, option),
12396
12401
(13, claimable_htlc_onion_fields, optional_vec),
12397
12402
(14, decode_update_add_htlcs, option),
12403
+ (15, inbound_payment_id_secret, option),
12398
12404
});
12399
12405
let mut decode_update_add_htlcs = decode_update_add_htlcs.unwrap_or_else(|| new_hash_map());
12400
12406
if fake_scid_rand_bytes.is_none() {
@@ -12405,6 +12411,10 @@ where
12405
12411
probing_cookie_secret = Some(args.entropy_source.get_secure_random_bytes());
12406
12412
}
12407
12413
12414
+ if inbound_payment_id_secret.is_none() {
12415
+ inbound_payment_id_secret = Some(args.entropy_source.get_secure_random_bytes());
12416
+ }
12417
+
12408
12418
if let Some(events) = events_override {
12409
12419
pending_events_read = events;
12410
12420
}
@@ -12930,6 +12940,7 @@ where
12930
12940
fake_scid_rand_bytes: fake_scid_rand_bytes.unwrap(),
12931
12941
12932
12942
probing_cookie_secret: probing_cookie_secret.unwrap(),
12943
+ inbound_payment_id_secret: inbound_payment_id_secret.unwrap(),
12933
12944
12934
12945
our_network_pubkey,
12935
12946
secp_ctx,
0 commit comments