From abafbacd8266fbc09ee3c69cd7e4f35f10c3ea30 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 16 Oct 2017 14:25:40 +0200 Subject: [PATCH] change rpc test witness_program to claim_script --- contrib/assets_tutorial/assets_tutorial.py | 2 +- contrib/assets_tutorial/assets_tutorial.sh | 4 ++-- qa/rpc-tests/pegging.py | 4 ++-- src/validation.cpp | 2 +- src/wallet/rpcwallet.cpp | 20 ++++++++++---------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/contrib/assets_tutorial/assets_tutorial.py b/contrib/assets_tutorial/assets_tutorial.py index e12e25bfda..248416902a 100755 --- a/contrib/assets_tutorial/assets_tutorial.py +++ b/contrib/assets_tutorial/assets_tutorial.py @@ -440,7 +440,7 @@ def sync_all(e1, e2): raw = bitcoin.getrawtransaction(txid) # Attempt claim! -claimtxid = e1.claimpegin(raw, proof, addrs["witness_program"]) +claimtxid = e1.claimpegin(raw, proof, addrs["claim_script"]) sync_all(e1, e2) # Other node should accept to mempool and mine diff --git a/contrib/assets_tutorial/assets_tutorial.sh b/contrib/assets_tutorial/assets_tutorial.sh index d9ef72e43c..0e3fee7e06 100755 --- a/contrib/assets_tutorial/assets_tutorial.sh +++ b/contrib/assets_tutorial/assets_tutorial.sh @@ -308,7 +308,7 @@ b-cli generate 101 e1-cli getpeginaddress # Changes each time as it's a new sidechain address as well as new "tweak" for the watchmen keys # mainchain_address : where you send your bitcoin from Bitcoin network -# witness_program: what script will have to be satisfied to spent the peg-in input +# claim_script: what script will have to be satisfied to spent the peg-in input # Each call of this takes the pubkeys defined in the config file, adds a random number to them # that is essetially the hash of the sidechain_address and other information, @@ -320,7 +320,7 @@ e1-cli getpeginaddress ADDRS=$(e1-cli getpeginaddress) MAINCHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['mainchain_address'])") -SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['witness_program'])") +SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['claim_script'])") #Send funds to unique watchmen P2SH address TXID=$(b-cli sendtoaddress $MAINCHAIN 1) diff --git a/qa/rpc-tests/pegging.py b/qa/rpc-tests/pegging.py index 05797eff8a..ae61964d83 100755 --- a/qa/rpc-tests/pegging.py +++ b/qa/rpc-tests/pegging.py @@ -151,9 +151,9 @@ def sync_all(sidechain, sidechain2): # Should fail due to non-matching wallet address try: pegtxid = sidechain.claimpegin(raw, proof, sidechain.getnewaddress()) - raise Exception("Peg-in with non-matching witness_program should fail.") + raise Exception("Peg-in with non-matching claim_script should fail.") except JSONRPCException as e: - assert("Given witness_program is not a valid v0 witness program" in e.error["message"]) + assert("Given claim_script is not a valid v0 witness program" in e.error["message"]) pass # 12 confirms allows in mempool diff --git a/src/validation.cpp b/src/validation.cpp index 94a8b49023..1ce0569f51 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2361,7 +2361,7 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p // 1) value - the value of the pegin output // 2) asset type - the asset type being pegged in // 3) genesis blockhash - genesis block of the parent chain - // 4) witness program - program that script evaluation will be evaluated against + // 4) claim script - script to be evaluated for spend authorization // 5) serialized transaction - serialized bitcoin transaction // 6) txout proof - merkle proof connecting transaction to header // diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9b3146bd89..68fcdd097a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3403,7 +3403,7 @@ UniValue getpeginaddress(const JSONRPCRequest& request) "\nResult:\n" "\"mainchain_address\" (string) Mainchain Bitcoin deposit address to send bitcoin to\n" - "\"witness_program\" (string) The witness program in hex that was committed to. This may be required in `claimpegin` to retrieve pegged-in funds\n" + "\"claim_script\" (string) The claim script in hex that was committed to. This may be required in `claimpegin` to retrieve pegged-in funds\n" "\nExamples:\n" + HelpExampleCli("getpeginaddress", "") + HelpExampleRpc("getpeginaddress", "") @@ -3430,10 +3430,10 @@ UniValue getpeginaddress(const JSONRPCRequest& request) UniValue fundinginfo(UniValue::VOBJ); - AuditLogPrintf("%s : getpeginaddress mainchain_address: %s witness_program: %s\n", getUser(), destAddr.ToString(), HexStr(witProg)); + AuditLogPrintf("%s : getpeginaddress mainchain_address: %s claim_script: %s\n", getUser(), destAddr.ToString(), HexStr(witProg)); fundinginfo.pushKV("mainchain_address", destAddr.ToString()); - fundinginfo.pushKV("witness_program", HexStr(witProg)); + fundinginfo.pushKV("claim_script", HexStr(witProg)); return fundinginfo; } @@ -3513,14 +3513,14 @@ UniValue createrawpegin(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) throw std::runtime_error( - "createrawpegin bitcoinTx txoutproof ( witness_program )\n" + "createrawpegin bitcoinTx txoutproof ( claim_script )\n" "\nCreates a raw transaction to claim coins from the main chain by creating a withdraw transaction with the necessary metadata after the corresponding Bitcoin transaction.\n" "Note that this call will not sign the transaction.\n" "If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n" "\nArguments:\n" "1. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress\n" "2. \"txoutproof\" (string, required) A rawtxoutproof (in hex) generated by bitcoind's `gettxoutproof` containing a proof of only bitcoinTx\n" - "3. \"witness_program\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n" + "3. \"claim_script\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n" "\nResult:\n" "{\n" " \"transaction\" (string) Raw transaction in hex\n" @@ -3576,7 +3576,7 @@ UniValue createrawpegin(const JSONRPCRequest& request) std::vector 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 witness_program is not a valid v0 witness program."); + throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script is not a valid v0 witness program."); } nOut = GetPeginTxnOutputIndex(txBTC, witnessProgScript); } @@ -3681,14 +3681,14 @@ UniValue claimpegin(const JSONRPCRequest& request) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) throw std::runtime_error( - "claimpegin bitcoinTx txoutproof ( witness_program )\n" + "claimpegin bitcoinTx txoutproof ( claim_script )\n" "\nClaim coins from the main chain by creating a withdraw transaction with the necessary metadata after the corresponding Bitcoin transaction.\n" "Note that the transaction will not be relayed unless it is buried at least 102 blocks deep.\n" "If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n" "\nArguments:\n" "1. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress\n" "2. \"txoutproof\" (string, required) A rawtxoutproof (in hex) generated by bitcoind's `gettxoutproof` containing a proof of only bitcoinTx\n" - "3. \"witness_program\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n" + "3. \"claim_script\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n" "\nResult:\n" "\"txid\" (string) Txid of the resulting sidechain transaction\n" "\nExamples:\n" @@ -4062,8 +4062,8 @@ static const CRPCCommand commands[] = { "wallet", "dumpissuanceblindingkey", &dumpissuanceblindingkey, true, {"txid", "vin"} }, { "wallet", "dumpwallet", &dumpwallet, true, {"filename"} }, { "wallet", "encryptwallet", &encryptwallet, true, {"passphrase"} }, - { "wallet", "claimpegin", &claimpegin, false, {"bitcoinT", "txoutproof", "witness_program"} }, - { "wallet", "createrawpegin", &createrawpegin, false, {"bitcoinT", "txoutproof", "witness_program"} }, + { "wallet", "claimpegin", &claimpegin, false, {"bitcoinT", "txoutproof", "claim_script"} }, + { "wallet", "createrawpegin", &createrawpegin, false, {"bitcoinT", "txoutproof", "claim_script"} }, { "wallet", "getaccountaddress", &getaccountaddress, true, {"account"} }, { "wallet", "getaccount", &getaccount, true, {"address"} }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, {"account"} },