Skip to content

Commit

Permalink
pyln: fix msat float multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schmoock committed Dec 3, 2020
1 parent 147ae5c commit b814575
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __sub__(self, other: 'Millisatoshi') -> 'Millisatoshi':
return Millisatoshi(int(self) - int(other))

def __mul__(self, other: int) -> 'Millisatoshi':
return Millisatoshi(self.millisatoshis * other)
return Millisatoshi(int(self.millisatoshis * other))

def __truediv__(self, other: Union[int, float]) -> 'Millisatoshi':
return Millisatoshi(int(self.millisatoshis / other))
Expand Down
2 changes: 0 additions & 2 deletions contrib/pyln-client/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def test_zero():
assert int(amount) == 0


@pytest.mark.xfail
def test_round_zero():
# everything below 1msat shoud round down to zero
amount = Millisatoshi("1msat") * 0.9
Expand Down Expand Up @@ -151,7 +150,6 @@ def test_round_zero():
assert int(amount) == 0


@pytest.mark.xfail
def test_round_down():
# sub msat significatns should be floored
amount = Millisatoshi("2msat") * 0.9
Expand Down

0 comments on commit b814575

Please sign in to comment.