mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock
This commit is contained in:
parent
132ea9b48f
commit
3dcbb9b6b4
3 changed files with 41 additions and 21 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue