Browse Source

plyn: use math.floor for msat mul and div

fix-mocks
Michael Schmoock 4 years ago
committed by Christian Decker
parent
commit
362284981d
  1. 6
      contrib/pyln-client/pyln/client/lightning.py

6
contrib/pyln-client/pyln/client/lightning.py

@ -177,13 +177,13 @@ 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(int(self.millisatoshis * other)) return Millisatoshi(floor(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(floor(self.millisatoshis / other))
def __floordiv__(self, other: Union[int, float]) -> 'Millisatoshi': 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': def __mod__(self, other: Union[float, int]) -> 'Millisatoshi':
return Millisatoshi(int(self.millisatoshis % other)) return Millisatoshi(int(self.millisatoshis % other))

Loading…
Cancel
Save