rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Rename `Htlc::to_bitcoin_amount` to `satoshi_amount`

Open jirijakes opened this issue 1 year ago • 8 comments

Per https://github.com/lightningdevkit/rust-lightning/pull/3063#discussion_r1622867330 .

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

jirijakes avatar Jun 06 '24 01:06 jirijakes

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 :warning:

:exclamation: 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 06 '24 02:06 codecov-commenter

@tnull , I called it amount at first (https://github.com/lightningdevkit/rust-lightning/pull/3063#discussion_r1599060322) 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.

jirijakes avatar Jun 06 '24 07:06 jirijakes

@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?

tnull avatar Jun 06 '24 07:06 tnull

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 avatar Jun 06 '24 14:06 TheBlueMatt

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 :)

TheBlueMatt avatar Jun 06 '24 14:06 TheBlueMatt

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?

tnull avatar Jun 07 '24 10:06 tnull

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

TheBlueMatt avatar Jun 07 '24 15:06 TheBlueMatt

amount_sats :)

G8XSU avatar Jun 11 '24 19:06 G8XSU