Skip to content

Commit

Permalink
reject non-hex strings for claim_script
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Sep 25, 2018
1 parent af19891 commit d084d36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3586,6 +3586,10 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
CScript witnessProgScript;
unsigned int nOut = txBTC.vout.size();
if (request.params.size() > 2) {
std::string claim_script = ParseHex(request.params[2].get_str());
if (!IsHex(claim_script)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script is not hex.");
}
// If given manually, no need for it to be a witness script
std::vector<unsigned char> witnessBytes(ParseHex(request.params[2].get_str()));
witnessProgScript = CScript(witnessBytes.begin(), witnessBytes.end());
Expand Down

0 comments on commit d084d36

Please sign in to comment.