Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
Merge version 0.2.5.13 from dev
Browse files Browse the repository at this point in the history
Merge version 0.2.5.13 into Master
  • Loading branch information
Greg-Griffith authored and Greg Griffith committed Nov 26, 2018
2 parents 6032bc4 + 776ba69 commit 52609fe
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 5)
define(_CLIENT_VERSION_BUILD, 12) # version 99 here indicates an unreleased version
define(_CLIENT_VERSION_BUILD, 13) # version 99 here indicates an unreleased version
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 5
#define CLIENT_VERSION_BUILD 12
#define CLIENT_VERSION_BUILD 13

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
40 changes: 39 additions & 1 deletion src/rpc/rpcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,45 @@ void RPCTypeCheckObj(const UniValue &o, const std::map<std::string, UniValue::VT
}
}

CAmount AmountFromValue(const UniValue &value)

const std::string TruncateDecimals(const std::string valstr)
{
std::string fixedNum = "";
bool decimalFound = false;
int remainingPrecision = 6;
for(unsigned int pos = 0; pos < valstr.length(); pos++)
{
if(decimalFound)
{
remainingPrecision--;
}
if(valstr[pos] == '.')
{
decimalFound = true;
}
fixedNum = fixedNum + valstr[pos];
if(remainingPrecision <= 0)
{
break;
}
}
const std::string result = fixedNum;
return result;
}

CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
CAmount amount;
if (!ParseFixedPoint(TruncateDecimals(value.getValStr()), 6, &amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
if (!MoneyRange(amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");
return amount;
}

CAmount AmountFromValue_Original(const UniValue &value)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
Expand Down

0 comments on commit 52609fe

Please sign in to comment.