Skip to content

Commit 755fed4

Browse files
fixup! blip42: Add ContactInfo field to PaymentSent event for contact management
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent 0a43a30 commit 755fed4

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ where
10791079
// Extract ContactInfo from invoice_request if present
10801080
let contact_info = invoice_request.and_then(|inv_req| {
10811081
let contact_secret_bytes = inv_req.contact_secret()?;
1082-
let payer_offer_bytes = inv_req.payer_offer()?;
1082+
let payer_offer = inv_req.payer_offer()?;
10831083

10841084
// Deserialize into ContactInfo
10851085
use crate::offers::contacts::ContactSecrets;
@@ -1090,8 +1090,6 @@ where
10901090
contact_secret_bytes.try_into().ok()?
10911091
);
10921092

1093-
let payer_offer = Offer::try_from(payer_offer_bytes.to_vec()).ok()?;
1094-
10951093
Some(events::ContactInfo { contact_secrets, payer_offer })
10961094
});
10971095

@@ -1110,21 +1108,17 @@ where
11101108
// Extract ContactInfo from invreq
11111109
let contact_info = {
11121110
let contact_secret_bytes = invreq.contact_secret();
1113-
let payer_offer_bytes = invreq.payer_offer();
1111+
let payer_offer = invreq.payer_offer();
11141112

1115-
match (contact_secret_bytes, payer_offer_bytes) {
1116-
(Some(secret), Some(payer_offer_bytes)) => {
1113+
match (contact_secret_bytes, payer_offer) {
1114+
(Some(secret), Some(payer_offer)) => {
11171115
use crate::offers::contacts::ContactSecrets;
11181116

11191117
let contact_secrets = secret.try_into().ok()
11201118
.map(|s| ContactSecrets::new(s));
11211119

1122-
let payer_offer = crate::offers::offer::Offer::try_from(payer_offer_bytes.to_vec()).ok();
1123-
11241120
contact_secrets.and_then(|cs|
1125-
payer_offer.and_then(|po|
1126-
Some(events::ContactInfo { contact_secrets: cs, payer_offer: po })
1127-
)
1121+
Some(events::ContactInfo { contact_secrets: cs, payer_offer })
11281122
)
11291123
},
11301124
_ => None,

0 commit comments

Comments
 (0)