From 73fd95119fc133943eb23a924394ca24f3d851fe Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 14 May 2019 15:26:21 +0500 Subject: [PATCH] added protection from corrupted old version targetSymbol --- src/rpc/crosschain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 35409323d..dc8aecd46 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -1420,6 +1420,7 @@ UniValue getwalletburntransactions(const UniValue& params, bool fHelp) UnmarshalBurnTx(*pwtx, targetSymbol, &targetCCid, payoutsHash, rawproof)) { UniValue entry(UniValue::VOBJ); entry.push_back(Pair("txid", pwtx->GetHash().GetHex())); + if (vopret.begin()[0] == EVAL_TOKENS) { // get burned token value std::vector> oprets; @@ -1460,6 +1461,12 @@ UniValue getwalletburntransactions(const UniValue& params, bool fHelp) } else entry.push_back(Pair("burnedAmount", ValueFromAmount(pwtx->vout.back().nValue))); // coins + + // check for corrupted strings (look for non-printable chars) from some older versions + // which caused "couldn't parse reply from server" error on client: + if (std::find_if(targetSymbol.begin(), targetSymbol.end(), [](int c) {return !std::isprint(c);}) != targetSymbol.end()) + targetSymbol = "corrupted"; + entry.push_back(Pair("targetSymbol", targetSymbol)); entry.push_back(Pair("targetCCid", std::to_string(targetCCid))); if (mytxid_inmempool(pwtx->GetHash()))