From 362284981d3f5515c48cfb5a662d9ff9db103368 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 7 Dec 2020 11:19:27 +0100 Subject: [PATCH] plyn: use math.floor for msat mul and div --- contrib/pyln-client/pyln/client/lightning.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index e87a57c05..753bd8f2c 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -177,13 +177,13 @@ class Millisatoshi: return Millisatoshi(int(self) - int(other)) def __mul__(self, other: int) -> 'Millisatoshi': - return Millisatoshi(int(self.millisatoshis * other)) + return Millisatoshi(floor(self.millisatoshis * other)) def __truediv__(self, other: Union[int, float]) -> 'Millisatoshi': - return Millisatoshi(int(self.millisatoshis / other)) + return Millisatoshi(floor(self.millisatoshis / other)) def __floordiv__(self, other: Union[int, float]) -> 'Millisatoshi': - return Millisatoshi(int(self.millisatoshis // float(other))) + return Millisatoshi(floor(self.millisatoshis // float(other))) def __mod__(self, other: Union[float, int]) -> 'Millisatoshi': return Millisatoshi(int(self.millisatoshis % other))