Skip to content

Commit

Permalink
Merge pull request #2310 from barton2526/rpc_float
Browse files Browse the repository at this point in the history
rpc: Don't use floating point in getreceivedbyaddress
  • Loading branch information
jamescowens committed Sep 1, 2021
2 parents dd3c523 + 38e5a59 commit 0862230
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Gridcoin address");
scriptPubKey.SetDestination(address.Get());
if (IsMine(*pwalletMain,scriptPubKey) == ISMINE_NO)
return (double)0.0;
return ValueFromAmount(0);

// Minimum confirmations
int nMinDepth = 1;
Expand All @@ -562,7 +562,7 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp)
}
}

return ValueFromAmount(nAmount);
return ValueFromAmount(nAmount);
}


Expand Down Expand Up @@ -619,7 +619,7 @@ UniValue getreceivedbyaccount(const UniValue& params, bool fHelp)
}
}

return (double)nAmount / (double)COIN;
return ValueFromAmount(nAmount);
}

int64_t GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMinDepth, const isminefilter& filter = ISMINE_SPENDABLE)
Expand Down

0 comments on commit 0862230

Please sign in to comment.