Skip to content

Commit

Permalink
Update rpcserver.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
modcrypto committed Oct 12, 2018
1 parent d06ed84 commit 0a794c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/rpcserver.cpp
Expand Up @@ -93,7 +93,14 @@ static inline int64_t roundint64(double d)

CAmount AmountFromValue(const Value& value)
{
double dAmount = value.get_real();
double dAmount = 0;
if(value.type()==str_type){
if(!ParseDouble(value.get_str(), &dAmount)){
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
}
}else{
dAmount = value.get_real();
}
if (dAmount <= 0.0 || dAmount > 21000000.0)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
CAmount nAmount = roundint64(dAmount * COIN);
Expand Down

0 comments on commit 0a794c4

Please sign in to comment.