Skip to content

Commit d92a568

Browse files
committed
Add more debug_asserts for updating BOLT12 payment hashes
1 parent cd8958f commit d92a568

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/payment/store.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ impl PaymentDetails {
8585
PaymentDirection::Outbound,
8686
"We should only ever override payment hash for outbound BOLT 12 payments"
8787
);
88+
debug_assert!(
89+
hash.is_none() || *hash == hash_opt,
90+
"We should never change a payment hash after being initially set"
91+
);
8892
update_if_necessary!(*hash, hash_opt);
8993
},
9094
PaymentKind::Bolt12Refund { ref mut hash, .. } => {
@@ -93,6 +97,10 @@ impl PaymentDetails {
9397
PaymentDirection::Outbound,
9498
"We should only ever override payment hash for outbound BOLT 12 payments"
9599
);
100+
debug_assert!(
101+
hash.is_none() || *hash == hash_opt,
102+
"We should never change a payment hash after being initially set"
103+
);
96104
update_if_necessary!(*hash, hash_opt);
97105
},
98106
_ => {

0 commit comments

Comments
 (0)