]> Git Repo - VerusCoin.git/blobdiff - src/core_read.cpp
Merge pull request #5470
[VerusCoin.git] / src / core_read.cpp
index 179d3514a49377900b99d30e4de471e91b639c48..750f83ee52cb109df171097b65ca597821a4bf3d 100644 (file)
@@ -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 <boost/assign/list_of.hpp>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/replace.hpp>
-#include "univalue/univalue.h"
+#include <boost/algorithm/string/split.hpp>
+#include <boost/assign/list_of.hpp>
 
-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 (const std::exception &) {
+    catch (const std::exception&) {
+        return false;
+    }
+
+    return true;
+}
+
+bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk)
+{
+    if (!IsHex(strHexBlk))
+        return false;
+
+    std::vector<unsigned char> blockData(ParseHex(strHexBlk));
+    CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION);
+    try {
+        ssBlock >> block;
+    }
+    catch (const std::exception&) {
         return false;
     }
 
This page took 0.0237 seconds and 4 git commands to generate.