mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "core_io.h"
|
||||
|
||||
#include "core/block.h"
|
||||
#include "core/transaction.h"
|
||||
#include "script/script.h"
|
||||
#include "serialize.h"
|
||||
@@ -108,6 +109,23 @@ bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx)
|
||||
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;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint256 ParseHashUV(const UniValue& v, const string& strName)
|
||||
{
|
||||
string strHex;
|
||||
|
||||
Reference in New Issue
Block a user