fix rounding problem

This commit is contained in:
adityapk00
2018-11-22 14:36:00 -08:00
parent 1d9efbfcfe
commit 3cd9fb9e29
3 changed files with 12 additions and 11 deletions

View File

@@ -320,7 +320,9 @@ void RPC::fillTxJsonParams(json& params, Tx tx) {
// Construct the JSON params
json rec = json::object();
rec["address"] = toAddr.addr.toStdString();
rec["amount"] = toAddr.amount;
// Force it through string for rounding. Without this, decimal points beyond 8 places
// will appear, causing an "invalid amount" error
rec["amount"] = QString::number(toAddr.amount, 'f', 8).toDouble();
if (toAddr.addr.startsWith("z") && !toAddr.encodedMemo.trimmed().isEmpty())
rec["memo"] = toAddr.encodedMemo.toStdString();