Skip to content

Conversation

jirijakes
Copy link
Contributor

Per #3063 (comment) .

I believe it's soon enough after the method was first introduced that renaming it should not have big negative impact, if any.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.96%. Comparing base (e5b7402) to head (ae59eec).
Report is 4 commits behind head on main.

Files Patch % Lines
lightning/src/ln/chan_utils.rs 80.00% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3099      +/-   ##
==========================================
+ Coverage   89.86%   89.96%   +0.09%     
==========================================
  Files         119      119              
  Lines       97507    98177     +670     
  Branches    97507    98177     +670     
==========================================
+ Hits        87629    88324     +695     
+ Misses       7307     7291      -16     
+ Partials     2571     2562       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Generally looks good, although tbh. I find satoshi_amount also a bit confusing as the Amount type's point is exactly that is independent of a denomination.

Should the method maybe be just be named fn amount(&self) -> Amount or fn as_amount(&self) -> Amount?

(cc @TheBlueMatt as he made the original comment)

@jirijakes
Copy link
Contributor Author

@tnull , I called it amount at first (#3063 (comment)) but I agree with Matt that it might be confusing, given that amount of HTLC has diferent meaning.

The 'satoshi' part should invoke that there will be some rounding happening.

@tnull
Copy link
Contributor

tnull commented Jun 6, 2024

@tnull , I called it amount at first (#3063 (comment)) but I agree with Matt that it might be confusing, given that amount of HTLC has diferent meaning.

The 'satoshi' part should invoke that there will be some rounding happening.

Ah, I had forgotten about that. Given that it really just performs integer division, should we be explicit here and call it floor_amount or amount_floor, similar to, e.g., u32::div_floor?

@TheBlueMatt
Copy link
Collaborator

Naming is hard :). I'm a bit meh on floor_amount because it doesn't mention the unit being floor'd to, which I think substantially improves readability of callsites.

@TheBlueMatt
Copy link
Collaborator

I believe it's soon enough after the method was first introduced that renaming it should not have big negative impact, if any.

Its not in a release, so there's no impact :)

@tnull
Copy link
Contributor

tnull commented Jun 7, 2024

Naming is hard :). I'm a bit meh on floor_amount because it doesn't mention the unit being floor'd to, which I think substantially improves readability of callsites.

So floor_sats_amount or amount_floor_sats?

@TheBlueMatt
Copy link
Collaborator

That would be good with me, or amount_sats_floor or any other permutation :)

@G8XSU
Copy link
Contributor

G8XSU commented Jun 11, 2024

amount_sats :)

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.

5 participants