From 70e68c6361ac2a1083c54137fe1e96e296ee2a70 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 27 Aug 2018 11:30:43 -0400 Subject: [PATCH] handle amount passed as float --- lbrynet/daemon/Daemon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 16c7247f2..52029a8e6 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -3297,7 +3297,7 @@ class Daemon(AuthJSONRPCServer): raise ValueError("Account with name '{}' already exists.".format(account_name)) @staticmethod - def get_dewies_or_error(argument: str, amount: Union[str, int]): + def get_dewies_or_error(argument: str, amount: Union[str, int, float]): if isinstance(amount, str): if '.' in amount: return int(Decimal(amount) * COIN) @@ -3305,6 +3305,8 @@ class Daemon(AuthJSONRPCServer): amount = int(amount) if isinstance(amount, int): return amount * COIN + if isinstance(amount, float): + return int(amount * COIN) raise ValueError("Invalid value for '{}' argument: {}".format(argument, amount))