X-Git-Url: https://repo.jachan.dev/VerusCoin.git/blobdiff_plain/cbd22a50c4b3d2d0f133c5f8d34c9c7aca9c7f4f..111a7d45f17fccdbff05a6afec222fe61684b860:/src/core_read.cpp diff --git a/src/core_read.cpp b/src/core_read.cpp index efcecb106..750f83ee5 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -1,23 +1,28 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" -#include "core.h" -#include "serialize.h" + +#include "primitives/block.h" +#include "primitives/transaction.h" #include "script/script.h" +#include "serialize.h" +#include "streams.h" +#include "univalue/univalue.h" #include "util.h" +#include "utilstrencodings.h" +#include "version.h" -#include #include #include -#include #include -#include "univalue/univalue.h" +#include +#include -using namespace std; using namespace boost; using namespace boost::algorithm; +using namespace std; CScript ParseScript(std::string s) { @@ -97,7 +102,24 @@ bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx) try { ssData >> tx; } - catch (std::exception &e) { + catch (const std::exception&) { + return false; + } + + return true; +} + +bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk) +{ + if (!IsHex(strHexBlk)) + return false; + + std::vector blockData(ParseHex(strHexBlk)); + CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION); + try { + ssBlock >> block; + } + catch (const std::exception&) { return false; }