Skip to content

Commit abafbac

Browse files
committed
change rpc test witness_program to claim_script
1 parent 851a30b commit abafbac

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

contrib/assets_tutorial/assets_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def sync_all(e1, e2):
440440
raw = bitcoin.getrawtransaction(txid)
441441

442442
# Attempt claim!
443-
claimtxid = e1.claimpegin(raw, proof, addrs["witness_program"])
443+
claimtxid = e1.claimpegin(raw, proof, addrs["claim_script"])
444444
sync_all(e1, e2)
445445

446446
# Other node should accept to mempool and mine

contrib/assets_tutorial/assets_tutorial.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ b-cli generate 101
308308
e1-cli getpeginaddress
309309
# Changes each time as it's a new sidechain address as well as new "tweak" for the watchmen keys
310310
# mainchain_address : where you send your bitcoin from Bitcoin network
311-
# witness_program: what script will have to be satisfied to spent the peg-in input
311+
# claim_script: what script will have to be satisfied to spent the peg-in input
312312

313313
# Each call of this takes the pubkeys defined in the config file, adds a random number to them
314314
# that is essetially the hash of the sidechain_address and other information,
@@ -320,7 +320,7 @@ e1-cli getpeginaddress
320320
ADDRS=$(e1-cli getpeginaddress)
321321

322322
MAINCHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['mainchain_address'])")
323-
SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['witness_program'])")
323+
SIDECHAIN=$(echo $ADDRS | python3 -c "import sys, json; print(json.load(sys.stdin)['claim_script'])")
324324

325325
#Send funds to unique watchmen P2SH address
326326
TXID=$(b-cli sendtoaddress $MAINCHAIN 1)

qa/rpc-tests/pegging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def sync_all(sidechain, sidechain2):
151151
# Should fail due to non-matching wallet address
152152
try:
153153
pegtxid = sidechain.claimpegin(raw, proof, sidechain.getnewaddress())
154-
raise Exception("Peg-in with non-matching witness_program should fail.")
154+
raise Exception("Peg-in with non-matching claim_script should fail.")
155155
except JSONRPCException as e:
156-
assert("Given witness_program is not a valid v0 witness program" in e.error["message"])
156+
assert("Given claim_script is not a valid v0 witness program" in e.error["message"])
157157
pass
158158

159159
# 12 confirms allows in mempool

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ bool IsValidPeginWitness(const CScriptWitness& pegin_witness, const COutPoint& p
23612361
// 1) value - the value of the pegin output
23622362
// 2) asset type - the asset type being pegged in
23632363
// 3) genesis blockhash - genesis block of the parent chain
2364-
// 4) witness program - program that script evaluation will be evaluated against
2364+
// 4) claim script - script to be evaluated for spend authorization
23652365
// 5) serialized transaction - serialized bitcoin transaction
23662366
// 6) txout proof - merkle proof connecting transaction to header
23672367
//

src/wallet/rpcwallet.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,7 +3403,7 @@ UniValue getpeginaddress(const JSONRPCRequest& request)
34033403

34043404
"\nResult:\n"
34053405
"\"mainchain_address\" (string) Mainchain Bitcoin deposit address to send bitcoin to\n"
3406-
"\"witness_program\" (string) The witness program in hex that was committed to. This may be required in `claimpegin` to retrieve pegged-in funds\n"
3406+
"\"claim_script\" (string) The claim script in hex that was committed to. This may be required in `claimpegin` to retrieve pegged-in funds\n"
34073407
"\nExamples:\n"
34083408
+ HelpExampleCli("getpeginaddress", "")
34093409
+ HelpExampleRpc("getpeginaddress", "")
@@ -3430,10 +3430,10 @@ UniValue getpeginaddress(const JSONRPCRequest& request)
34303430

34313431
UniValue fundinginfo(UniValue::VOBJ);
34323432

3433-
AuditLogPrintf("%s : getpeginaddress mainchain_address: %s witness_program: %s\n", getUser(), destAddr.ToString(), HexStr(witProg));
3433+
AuditLogPrintf("%s : getpeginaddress mainchain_address: %s claim_script: %s\n", getUser(), destAddr.ToString(), HexStr(witProg));
34343434

34353435
fundinginfo.pushKV("mainchain_address", destAddr.ToString());
3436-
fundinginfo.pushKV("witness_program", HexStr(witProg));
3436+
fundinginfo.pushKV("claim_script", HexStr(witProg));
34373437
return fundinginfo;
34383438
}
34393439

@@ -3513,14 +3513,14 @@ UniValue createrawpegin(const JSONRPCRequest& request)
35133513
{
35143514
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
35153515
throw std::runtime_error(
3516-
"createrawpegin bitcoinTx txoutproof ( witness_program )\n"
3516+
"createrawpegin bitcoinTx txoutproof ( claim_script )\n"
35173517
"\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"
35183518
"Note that this call will not sign the transaction.\n"
35193519
"If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n"
35203520
"\nArguments:\n"
35213521
"1. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress\n"
35223522
"2. \"txoutproof\" (string, required) A rawtxoutproof (in hex) generated by bitcoind's `gettxoutproof` containing a proof of only bitcoinTx\n"
3523-
"3. \"witness_program\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n"
3523+
"3. \"claim_script\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n"
35243524
"\nResult:\n"
35253525
"{\n"
35263526
" \"transaction\" (string) Raw transaction in hex\n"
@@ -3576,7 +3576,7 @@ UniValue createrawpegin(const JSONRPCRequest& request)
35763576
std::vector<unsigned char> witnessBytes(ParseHex(request.params[2].get_str()));
35773577
witnessProgScript = CScript(witnessBytes.begin(), witnessBytes.end());
35783578
if (!witnessProgScript.IsWitnessProgram(version, witnessProgram) || version != 0) {
3579-
throw JSONRPCError(RPC_INVALID_PARAMETER, "Given witness_program is not a valid v0 witness program.");
3579+
throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script is not a valid v0 witness program.");
35803580
}
35813581
nOut = GetPeginTxnOutputIndex(txBTC, witnessProgScript);
35823582
}
@@ -3681,14 +3681,14 @@ UniValue claimpegin(const JSONRPCRequest& request)
36813681

36823682
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
36833683
throw std::runtime_error(
3684-
"claimpegin bitcoinTx txoutproof ( witness_program )\n"
3684+
"claimpegin bitcoinTx txoutproof ( claim_script )\n"
36853685
"\nClaim coins from the main chain by creating a withdraw transaction with the necessary metadata after the corresponding Bitcoin transaction.\n"
36863686
"Note that the transaction will not be relayed unless it is buried at least 102 blocks deep.\n"
36873687
"If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n"
36883688
"\nArguments:\n"
36893689
"1. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress\n"
36903690
"2. \"txoutproof\" (string, required) A rawtxoutproof (in hex) generated by bitcoind's `gettxoutproof` containing a proof of only bitcoinTx\n"
3691-
"3. \"witness_program\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n"
3691+
"3. \"claim_script\" (string, optional) The witness program generated by getpeginaddress. Only needed if not in wallet.\n"
36923692
"\nResult:\n"
36933693
"\"txid\" (string) Txid of the resulting sidechain transaction\n"
36943694
"\nExamples:\n"
@@ -4062,8 +4062,8 @@ static const CRPCCommand commands[] =
40624062
{ "wallet", "dumpissuanceblindingkey", &dumpissuanceblindingkey, true, {"txid", "vin"} },
40634063
{ "wallet", "dumpwallet", &dumpwallet, true, {"filename"} },
40644064
{ "wallet", "encryptwallet", &encryptwallet, true, {"passphrase"} },
4065-
{ "wallet", "claimpegin", &claimpegin, false, {"bitcoinT", "txoutproof", "witness_program"} },
4066-
{ "wallet", "createrawpegin", &createrawpegin, false, {"bitcoinT", "txoutproof", "witness_program"} },
4065+
{ "wallet", "claimpegin", &claimpegin, false, {"bitcoinT", "txoutproof", "claim_script"} },
4066+
{ "wallet", "createrawpegin", &createrawpegin, false, {"bitcoinT", "txoutproof", "claim_script"} },
40674067
{ "wallet", "getaccountaddress", &getaccountaddress, true, {"account"} },
40684068
{ "wallet", "getaccount", &getaccount, true, {"address"} },
40694069
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, {"account"} },

0 commit comments

Comments
 (0)