aboutsummaryrefslogtreecommitdiff
path: root/src/core_read.cpp
blob: 937dcd9c122b96c1be878d45e9b1e7c8b7dd182e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#include <vector>
#include "core_io.h"
#include "core.h"
#include "serialize.h"

using namespace std;

bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx)
{
    if (!IsHex(strHexTx))
        return false;

    vector<unsigned char> txData(ParseHex(strHexTx));
    CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
    try {
        ssData >> tx;
    }
    catch (std::exception &e) {
        return false;
    }

    return true;
}