mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
rpc: reject non-hex strings for claim_script
This commit is contained in:
parent
07c617bccd
commit
35364b6746
1 changed files with 5 additions and 1 deletions
|
|
@ -3586,8 +3586,12 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
|
|||
CScript witnessProgScript;
|
||||
unsigned int nOut = txBTC.vout.size();
|
||||
if (request.params.size() > 2) {
|
||||
const std::string claim_script = 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()));
|
||||
std::vector<unsigned char> witnessBytes(ParseHex(claim_script));
|
||||
witnessProgScript = CScript(witnessBytes.begin(), witnessBytes.end());
|
||||
nOut = GetPeginTxnOutputIndex(txBTC, witnessProgScript);
|
||||
if (nOut == txBTC.vout.size()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue