mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
pyln: fix msat float multiplication
This commit is contained in:
parent
2678cfb364
commit
565dc95a8e
@ -177,7 +177,7 @@ class Millisatoshi:
|
|||||||
return Millisatoshi(int(self) - int(other))
|
return Millisatoshi(int(self) - int(other))
|
||||||
|
|
||||||
def __mul__(self, other: int) -> 'Millisatoshi':
|
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':
|
def __truediv__(self, other: Union[int, float]) -> 'Millisatoshi':
|
||||||
return Millisatoshi(int(self.millisatoshis / other))
|
return Millisatoshi(int(self.millisatoshis / other))
|
||||||
|
@ -93,7 +93,6 @@ def test_zero():
|
|||||||
assert int(amount) == 0
|
assert int(amount) == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail
|
|
||||||
def test_round_zero():
|
def test_round_zero():
|
||||||
# everything below 1msat should round down to zero
|
# everything below 1msat should round down to zero
|
||||||
amount = Millisatoshi("1msat") * 0.9
|
amount = Millisatoshi("1msat") * 0.9
|
||||||
@ -151,7 +150,6 @@ def test_round_zero():
|
|||||||
assert int(amount) == 0
|
assert int(amount) == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail
|
|
||||||
def test_round_down():
|
def test_round_down():
|
||||||
# sub msat significatns should be floored
|
# sub msat significatns should be floored
|
||||||
amount = Millisatoshi("2msat") * 0.9
|
amount = Millisatoshi("2msat") * 0.9
|
||||||
|
Loading…
Reference in New Issue
Block a user