Skip to content

Commit

Permalink
don't require claim_script to be witness program for raw claim pegin
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Nov 6, 2017
1 parent da6960d commit 6cc380a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3571,13 +3571,9 @@ UniValue createrawpegin(const JSONRPCRequest& request)
CScript witnessProgScript;
unsigned int nOut = txBTC.vout.size();
if (request.params.size() > 2) {
int version = -1;
std::vector<unsigned char> witnessProgram;
// 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());
if (!witnessProgScript.IsWitnessProgram(version, witnessProgram) || version != 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script is not a valid v0 witness program.");
}
nOut = GetPeginTxnOutputIndex(txBTC, witnessProgScript);
if (nOut == txBTC.vout.size()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script does not match the given Bitcoin transaction.");
Expand Down

0 comments on commit 6cc380a

Please sign in to comment.