') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Aggregate `BlindedPayInfo` for blinded routes by valentinewallace · Pull Request #2514 · lightningdevkit/rust-lightning · GitHub
Skip to content

Aggregate BlindedPayInfo for blinded routes - #2514

Merged
TheBlueMatt merged 9 commits into
lightningdevkit:mainfrom
valentinewallace:2023-08-compute-blindedpayinfo
Sep 10, 2023
Merged

Aggregate BlindedPayInfo for blinded routes#2514
TheBlueMatt merged 9 commits into
lightningdevkit:mainfrom
valentinewallace:2023-08-compute-blindedpayinfo

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

BOLT 12 invoices encode BlindedPayInfo(s) as part of their hints for routing, whose fields are computed by aggregating fee/cltv/etc values from the hops along the blinded path. Helps address #1970.

Based on #2412.

@codecov-commenter

codecov-commenter commented Aug 23, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 88.19% and no project coverage change.

Comparison is base (61d896d) 90.59% compared to head (88a0063) 90.59%.
Report is 41 commits behind head on main.

❗ Current head 88a0063 differs from pull request most recent head 134f6f3. Consider uploading reports for the commit 134f6f3 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@ Coverage Diff @@## main #2514 +/- ##
========================================
Coverage 90.59% 90.59% ========================================
Files 110 110 Lines 57410 58062 +652 Branches 57410 58062 +652 ========================================
+ Hits 52008 52602 +594 - Misses 5402 5460 +58 
Files ChangedCoverage Δ
lightning/src/blinded_path/mod.rs100.00% <ø> (ø)
lightning/src/blinded_path/payment.rs78.90% <85.59%> (+78.90%)⬆️
lightning/src/ln/monitor_tests.rs98.06% <85.71%> (-0.46%)⬇️
lightning/src/chain/chainmonitor.rs94.91% <97.22%> (-0.12%)⬇️

... and 31 files with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@valentinewallacevalentinewallace mentioned this pull request Aug 13, 2023
1 task
@valentinewallacevalentinewallace added this to the 0.0.117 milestone Aug 23, 2023
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from 63025f8 to e87c68eCompareAugust 23, 2023 21:11
@jkczyz
jkczyz self-requested a review August 23, 2023 21:23
Comment threadlightning/src/blinded_path/payment.rs Outdated
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch 2 times, most recently from b159729 to 35b1dc8CompareAugust 24, 2023 15:33
Comment threadlightning/src/blinded_path/payment.rs
Comment threadlightning/src/blinded_path/mod.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch 3 times, most recently from c6df2b6 to 4b9f000CompareAugust 28, 2023 17:17
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from 4b9f000 to 3ec7789CompareAugust 28, 2023 17:23
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased to fix CI. I added test coverage for the min htlc computation to #2413 so this should be good for review.

Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs
Comment threadlightning/src/blinded_path/payment.rs Outdated
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch 5 times, most recently from f272645 to 5d0a982CompareAugust 30, 2023 15:38

@alecchendevalecchendev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorta confused by htlc_minimum_msat, everything else looks good

Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from 5d0a982 to 4777c29CompareSeptember 6, 2023 18:14
Comment threadlightning/src/blinded_path/payment.rs
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sorry for all the noise here, only one comment left I think.

@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from 4777c29 to a6f881bCompareSeptember 6, 2023 22:17
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

I think I addressed all feedback. Thought I saw something about not decrementing htlc_min but I don't see it anymore?

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

#2514 (comment) :)

@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from a6f881b to 88a0063CompareSeptember 7, 2023 17:33
Comment threadlightning/src/blinded_path/mod.rs Outdated
TheBlueMatt
TheBlueMatt previously approved these changes Sep 8, 2023
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch 2 times, most recently from 61658ae to a1b3fbbCompareSeptember 8, 2023 14:37
@valentinewallace
valentinewallaceforce-pushed the 2023-08-compute-blindedpayinfo branch from a1b3fbb to f3616e6CompareSeptember 8, 2023 14:43
@TheBlueMatt
TheBlueMatt merged commit 448b191 into lightningdevkit:mainSep 10, 2023
@valentinewallacevalentinewallace mentioned this pull request Sep 11, 2023
60 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@valentinewallace@codecov-commenter@TheBlueMatt@jkczyz@alecchendev