From 73fd95119fc133943eb23a924394ca24f3d851fe Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 14 May 2019 15:26:21 +0500 Subject: [PATCH 1/3] 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())) From 95907695349b2afc901124e25803dee9cd8fef8f Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 14 May 2019 18:43:19 +0500 Subject: [PATCH 2/3] corr check for corrupt val --- src/rpc/crosschain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index dc8aecd46..407d32f25 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -1464,8 +1464,10 @@ UniValue getwalletburntransactions(const UniValue& params, bool fHelp) // 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"; + // if (std::find_if(targetSymbol.begin(), targetSymbol.end(), [](int c) {return !std::isprint(c);}) != targetSymbol.end()) + UniValue testval(UniValue::VSTR); + if( !testval.read(targetSymbol) ) + targetSymbol = ""; entry.push_back(Pair("targetSymbol", targetSymbol)); entry.push_back(Pair("targetCCid", std::to_string(targetCCid))); From 406e54a00e30ccd6d88bf61b4da34b5cb3de2f0c Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 14 May 2019 19:13:18 +0500 Subject: [PATCH 3/3] returned isprint check --- src/rpc/crosschain.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 407d32f25..bf0dbea4c 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -1464,9 +1464,7 @@ UniValue getwalletburntransactions(const UniValue& params, bool fHelp) // 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()) - UniValue testval(UniValue::VSTR); - if( !testval.read(targetSymbol) ) + if (std::find_if(targetSymbol.begin(), targetSymbol.end(), [](int c) {return !std::isprint(c);}) != targetSymbol.end()) targetSymbol = ""; entry.push_back(Pair("targetSymbol", targetSymbol));