aboutsummaryrefslogtreecommitdiff
path: root/src/core_read.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-06-04 18:22:58 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-08-13 14:27:40 -0400
commit36b1b63f20cc718084971d2cadd04497a9b72634 (patch)
treeadf46bfa148f35463305f2c5e3175df147db2fb1 /src/core_read.cpp
parent3bd25c010c5cd19a8d68869ac9dab1f2fa40bd50 (diff)
downloadbitcoin-36b1b63f20cc718084971d2cadd04497a9b72634.tar.xz
rpc: Expose ProcessNewBlockHeaders
Diffstat (limited to 'src/core_read.cpp')
-rw-r--r--src/core_read.cpp14
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))