Use get_dewies_or_error method instead
This commit is contained in:
parent
002faf7a58
commit
ceb25f917a
1 changed files with 2 additions and 9 deletions
|
@ -1556,14 +1556,10 @@ class Daemon(AuthJSONRPCServer):
|
||||||
except (TypeError, URIParseError):
|
except (TypeError, URIParseError):
|
||||||
raise Exception("Invalid channel name")
|
raise Exception("Invalid channel name")
|
||||||
|
|
||||||
try:
|
amount = self.get_dewies_or_error("amount", amount)
|
||||||
amount = Decimal(amount)
|
|
||||||
except InvalidOperation:
|
|
||||||
raise TypeError("Amount does not represent a valid decimal")
|
|
||||||
|
|
||||||
if amount <= 0.0:
|
if amount <= 0.0:
|
||||||
raise Exception("Invalid amount")
|
raise Exception("Invalid amount")
|
||||||
amount = int(amount * COIN)
|
|
||||||
tx = yield self.wallet.claim_new_channel(channel_name, amount)
|
tx = yield self.wallet.claim_new_channel(channel_name, amount)
|
||||||
self.wallet.save()
|
self.wallet.save()
|
||||||
self.analytics_manager.send_new_channel()
|
self.analytics_manager.send_new_channel()
|
||||||
|
@ -2475,10 +2471,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
(dict) the resulting transaction
|
(dict) the resulting transaction
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
amount = self.get_dewies_or_error("amount", amount)
|
||||||
amount = Decimal(amount)
|
|
||||||
except InvalidOperation:
|
|
||||||
raise TypeError("Amount does not represent a valid decimal")
|
|
||||||
|
|
||||||
if amount < 0.0:
|
if amount < 0.0:
|
||||||
raise NegativeFundsError()
|
raise NegativeFundsError()
|
||||||
|
|
Loading…
Reference in a new issue