diff options
Diffstat (limited to 'src/core_read.cpp')
-rw-r--r-- | src/core_read.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp index a5df45aba1..b02016c014 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -145,6 +145,20 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no return false; } +bool DecodeHexBlockHeader(CBlockHeader& header, const std::string& hex_header) +{ + if (!IsHex(hex_header)) return false; + + const std::vector<unsigned char> header_data{ParseHex(hex_header)}; + CDataStream ser_header(header_data, SER_NETWORK, PROTOCOL_VERSION); + try { + ser_header >> header; + } catch (const std::exception&) { + return false; + } + return true; +} + bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk) { if (!IsHex(strHexBlk)) |