Skip to content

Fix a panic in Route's new fee-calculation methods and clean up #1088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

TheBlueMatt
Copy link
Collaborator

This addresses Val's feedback on the new Route fee- and
amount-calculation methods, including fixing the panic she
identified and cleaning up various docs and comments.

See #1063 (review)

@TheBlueMatt TheBlueMatt added this to the 0.0.101 milestone Sep 21, 2021
@codecov
Copy link

codecov bot commented Sep 21, 2021

Codecov Report

Merging #1088 (59925c1) into main (8f78bbd) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1088      +/-   ##
==========================================
- Coverage   90.75%   90.72%   -0.04%     
==========================================
  Files          65       65              
  Lines       33948    34044      +96     
==========================================
+ Hits        30811    30886      +75     
- Misses       3137     3158      +21     
Impacted Files Coverage Δ
lightning/src/routing/router.rs 96.00% <100.00%> (+<0.01%) ⬆️
lightning/src/ln/functional_tests.rs 97.50% <0.00%> (-0.04%) ⬇️
lightning/src/ln/peer_handler.rs 49.29% <0.00%> (+3.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f78bbd...59925c1. Read the comment docs.

This addresses Val's feedback on the new Route fee- and
amount-calculation methods, including fixing the panic she
identified and cleaning up various docs and comments.
@TheBlueMatt
Copy link
Collaborator Author

Addressed some comments from Jeff and squashed, will land after CI, diff is:

$ git diff-tree -U1 6ccbe887 59925c1f
diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs
index af783954..e60fd1ee 100644
--- a/lightning/src/routing/router.rs
+++ b/lightning/src/routing/router.rs
@@ -77,3 +77,3 @@ impl Route {
 	/// This doesn't include any extra payment made to the recipient, which can happen in excess of
-	/// the amount passed to [``get_route``]'s `final_value_msat`.
+	/// the amount passed to [`get_route`]'s `final_value_msat`.
 	pub fn get_total_fees(&self) -> u64 {
@@ -81,3 +81,3 @@ impl Route {
 		return self.paths.iter()
-			.flat_map(|path| path.split_last().map(|path_pfx| path_pfx.1).unwrap_or(&[]))
+			.flat_map(|path| path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]))
 			.map(|hop| &hop.fee_msat)
@@ -89,3 +89,3 @@ impl Route {
 		return self.paths.iter()
-			.map(|path| path.split_last().map(|hop| hop.0.fee_msat).unwrap_or(0))
+			.map(|path| path.split_last().map(|(hop, _)| hop.fee_msat).unwrap_or(0))
 			.sum();
$

@TheBlueMatt TheBlueMatt merged commit 5af0cb2 into lightningdevkit:main Sep 21, 2021
Sign up for free to 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.

3 participants