Skip to content

Commit 9ab8390

Browse files
committed
StrHexToScriptWithDefault helper function
1 parent e1ed37e commit 9ab8390

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/chainparams.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
3535
return genesis;
3636
}
3737

38+
static CScript StrHexToScriptWithDefault(std::string strScript, const CScript defaultScript)
39+
{
40+
CScript returnScript;
41+
if (!strScript.empty()) {
42+
std::vector<unsigned char> scriptData = ParseHex(strScript);
43+
returnScript = CScript(scriptData.begin(), scriptData.end());
44+
} else {
45+
returnScript = defaultScript;
46+
}
47+
return returnScript;
48+
}
49+
3850
/**
3951
* Build the genesis block. Note that the output of its generation
4052
* transaction cannot be spent since it did not originally exist in the

0 commit comments

Comments
 (0)