Skip to content

Commit

Permalink
Merge pull request #83 from RiverFinancial/sachin--eliminate-string-s…
Browse files Browse the repository at this point in the history
…lice-warning

Eliminate String.slice with -1 warnings
  • Loading branch information
SachinMeier authored Feb 27, 2024
2 parents 14f6d7e + 3bf6fb7 commit 59c1c57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/lightning_network/invoice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ defmodule Bitcoinex.LightningNetwork.Invoice do
{:ok, {network_name, nil}}

_ ->
amount_str = String.slice(rest_hrp, hrp_segwit_prefix_size..-1)
amount_str = String.slice(rest_hrp, hrp_segwit_prefix_size..-1//1)

case calculate_milli_satoshi(amount_str) do
{:ok, amount} ->
Expand All @@ -571,7 +571,7 @@ defmodule Bitcoinex.LightningNetwork.Invoice do
result =
case Regex.run(~r/[munp]$/, amount_str) do
[multiplier] when multiplier in @valid_multipliers ->
case Integer.parse(String.slice(amount_str, 0..-2)) do
case Integer.parse(String.slice(amount_str, 0..-2//1)) do
{amount, ""} ->
{:ok, to_bitcoin(amount, multiplier)}

Expand Down

0 comments on commit 59c1c57

Please sign in to comment.