Skip to content

Commit a18a88b

Browse files
committed
grammar: prefer peg-in to pegin in messages
1 parent 90b2b3b commit a18a88b

4 files changed

Lines changed: 28 additions & 28 deletions

File tree

src/chainparams.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ class CCustomParams : public CRegTestParams {
977977
pegin_subsidy = ParsePeginSubsidy(args);
978978
pegin_minimum = ParsePeginMinimum(args);
979979
if (pegin_subsidy.threshold < pegin_minimum.amount) {
980-
throw std::runtime_error(strprintf("Pegin subsidy threshold (%s) must be greater than or equal to pegin minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
980+
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
981981
}
982982

983983
// Calculate pegged Bitcoin asset
@@ -1228,7 +1228,7 @@ class CLiquidV1Params : public CChainParams {
12281228
pegin_subsidy = ParsePeginSubsidy(args);
12291229
pegin_minimum = ParsePeginMinimum(args);
12301230
if (pegin_subsidy.threshold < pegin_minimum.amount) {
1231-
throw std::runtime_error(strprintf("Pegin subsidy threshold (%s) must be greater than or equal to pegin minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
1231+
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
12321232
}
12331233

12341234
parentGenesisBlockHash = uint256S("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
@@ -1593,7 +1593,7 @@ class CLiquidV1TestParams : public CLiquidV1Params {
15931593
pegin_subsidy = ParsePeginSubsidy(args);
15941594
pegin_minimum = ParsePeginMinimum(args);
15951595
if (pegin_subsidy.threshold < pegin_minimum.amount) {
1596-
throw std::runtime_error(strprintf("Pegin subsidy threshold (%s) must be greater than or equal to pegin minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
1596+
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
15971597
}
15981598

15991599
if (args.IsArgSet("-parentgenesisblockhash")) {

src/init.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ void SetupServerArgs(ArgsManager& argsman)
629629
argsman.AddArg("-mainchainrpcpassword=<pwd>", "The rpc password which the daemon will use to connect to the trusted mainchain daemon to validate peg-ins, if enabled. (default: cookie auth)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::ELEMENTS);
630630
argsman.AddArg("-mainchainrpccookiefile=<file>", "The bitcoind cookie auth path which the daemon will use to connect to the trusted mainchain daemon to validate peg-ins. (default: `<datadir>/regtest/.cookie`)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
631631
argsman.AddArg("-mainchainrpctimeout=<n>", strprintf("Timeout in seconds during mainchain RPC requests, or 0 for no timeout. (default: %d)", DEFAULT_HTTP_CLIENT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
632-
argsman.AddArg("-peginconfirmationdepth=<n>", strprintf("Pegin claims must be this deep to be considered valid. (default: %d)", DEFAULT_PEGIN_CONFIRMATION_DEPTH), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
632+
argsman.AddArg("-peginconfirmationdepth=<n>", strprintf("Peg-in claims must be this deep to be considered valid. (default: %d)", DEFAULT_PEGIN_CONFIRMATION_DEPTH), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
633633
argsman.AddArg("-parentpubkeyprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 pubkey address. (default: %d)", 111), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
634634
argsman.AddArg("-parentscriptprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 script address. (default: %d)", 196), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
635635
argsman.AddArg("-parent_bech32_hrp", strprintf("The human-readable part of the parent chain's bech32 encoding. (default: %s)", "bc"), ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
@@ -1968,7 +1968,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19681968
if (gArgs.GetBoolArg("-validatepegin", Params().GetConsensus().has_parent_chain)) {
19691969
uiInterface.InitMessage(_("Awaiting mainchain RPC warmup").translated);
19701970
if (!MainchainRPCCheck()) {
1971-
const std::string err_msg = "ERROR: elements is set to verify pegins but cannot get a valid response from the mainchain daemon. Please check debug.log for more information.\n\nIf you haven't setup a bitcoind please get the latest stable version from https://bitcoincore.org/en/download/ or if you do not need to validate pegins set in your elements configuration validatepegin=0";
1971+
const std::string err_msg = "ERROR: elements is set to verify peg-ins but cannot get a valid response from the mainchain daemon. Please check debug.log for more information.\n\nIf you haven't setup a bitcoind please get the latest stable version from https://bitcoincore.org/en/download/ or if you do not need to validate peg-ins set in your elements configuration validatepegin=0";
19721972
// We fail immediately if this node has RPC server enabled
19731973
if (gArgs.GetBoolArg("-server", false)) {
19741974
InitError(Untranslated(err_msg));
@@ -1979,7 +1979,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19791979
gArgs.SoftSetArg("-validatepegin", "0");
19801980
}
19811981
}
1982-
// if we are validating pegin subsidy or minimum then we require bitcoind >= v25
1982+
// if we are validating peg-in subsidy or minimum then we require bitcoind >= v25
19831983
if (Params().GetPeginSubsidy().IsDefined() || Params().GetPeginMinimum().IsDefined()) {
19841984
UniValue params(UniValue::VARR);
19851985
UniValue reply = CallMainChainRPC("getnetworkinfo", params);
@@ -1990,7 +1990,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19901990
const int version = reply["result"]["version"].get_int();
19911991
const std::string& subversion = reply["result"]["subversion"].get_str();
19921992
if (version < 250000 && subversion.find("Satoshi") != std::string::npos) {
1993-
const std::string err = strprintf("ERROR: parent bitcoind must be version 25 or newer for pegin subsidy/minimum validation. Found version: %s", version);
1993+
const std::string err = strprintf("ERROR: parent bitcoind must be version 25 or newer for peg-in subsidy/minimum validation. Found version: %s", version);
19941994
InitError(Untranslated(err));
19951995
return false;
19961996
}

src/wallet/rpc/elements.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ RPCHelpMan initpegoutwallet()
453453
RPCHelpMan sendtomainchain_base()
454454
{
455455
return RPCHelpMan{"sendtomainchain",
456-
"\nSends sidechain funds to the given mainchain address, through the federated pegin mechanism\n"
456+
"\nSends sidechain funds to the given mainchain address, through the federated peg-in mechanism\n"
457457
+ wallet::HELP_REQUIRING_PASSPHRASE,
458458
{
459459
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination address on Bitcoin mainchain"},
@@ -842,18 +842,18 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
842842
// Make the tx
843843
CMutableTransaction mtx;
844844

845-
// Construct pegin input
845+
// Construct peg-in input
846846
CreatePegInInput(mtx, 0, txBTCRef, merkleBlock, claim_scripts, txData, txOutProofData, wallet->chain().getTip());
847847

848848
// Get value for peg-in output
849849
CAmount value = 0;
850850
if (!GetAmountFromParentChainPegin(value, *txBTCRef, mtx.vin[0].prevout.n)) {
851-
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to pegin must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex()));
851+
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to peg-in must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex()));
852852
}
853853

854854
const PeginMinimum pegin_minimum = Params().GetPeginMinimum();
855855
if (pwallet->chain().getTip()->nHeight >= pegin_minimum.height && value < pegin_minimum.amount) {
856-
throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Pegin amount (%d) is lower than the minimum pegin amount for this chain (%d).", FormatMoney(value), FormatMoney(pegin_minimum.amount)));
856+
throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Peg-in amount (%d) is lower than the minimum peg-in amount for this chain (%d).", FormatMoney(value), FormatMoney(pegin_minimum.amount)));
857857
}
858858

859859
const PeginSubsidy pegin_subsidy = Params().GetPeginSubsidy();
@@ -985,7 +985,7 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
985985
RPCHelpMan createrawpegin()
986986
{
987987
return RPCHelpMan{"createrawpegin",
988-
"\nCreates a raw transaction to claim coins from the main chain by creating a pegin transaction with the necessary metadata after the corresponding Bitcoin transaction.\n"
988+
"\nCreates a raw transaction to claim coins from the main chain by creating a peg-in transaction with the necessary metadata after the corresponding Bitcoin transaction.\n"
989989
"Note that this call will not sign the transaction.\n"
990990
"If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n",
991991
{
@@ -1035,7 +1035,7 @@ RPCHelpMan createrawpegin()
10351035
RPCHelpMan claimpegin()
10361036
{
10371037
return RPCHelpMan{"claimpegin",
1038-
"\nClaim coins from the main chain by creating a pegin transaction with the necessary metadata after the corresponding Bitcoin transaction.\n"
1038+
"\nClaim coins from the main chain by creating a peg-in transaction with the necessary metadata after the corresponding Bitcoin transaction.\n"
10391039
"Note that the transaction will not be relayed unless it is buried at least 102 blocks deep.\n"
10401040
"If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n",
10411041
{
@@ -1097,7 +1097,7 @@ RPCHelpMan claimpegin()
10971097
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
10981098
}
10991099

1100-
// To check if it's not double spending an existing pegin UTXO, we check mempool acceptance.
1100+
// To check if it's not double spending an existing peg-in UTXO, we check mempool acceptance.
11011101
const MempoolAcceptResult res = pwallet->chain().testPeginClaimAcceptance(MakeTransactionRef(mtx));
11021102
if (res.m_result_type != MempoolAcceptResult::ResultType::VALID) {
11031103
bilingual_str error = Untranslated(strprintf("Error: The transaction was rejected! Reason given: %s", res.m_state.ToString()));
@@ -1303,7 +1303,7 @@ RPCHelpMan blindrawtransaction()
13031303
for (size_t nIn = 0; nIn < tx.vin.size(); ++nIn) {
13041304
COutPoint prevout = tx.vin[nIn].prevout;
13051305

1306-
// Special handling for pegin inputs: no blinds and explicit amount/asset.
1306+
// Special handling for peg-in inputs: no blinds and explicit amount/asset.
13071307
if (tx.vin[nIn].m_is_pegin) {
13081308
std::string err;
13091309
if (tx.witness.vtxinwit.size() != tx.vin.size() || !IsValidPeginWitness(tx.witness.vtxinwit[nIn].m_pegin_witness, fedpegscripts, prevout, err, false)) {

test/functional/feature_pegin_subsidy.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
243243
assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT)
244244
assert_equal(result["pegin_subsidy_active"], False)
245245

246-
self.log.info("check min pegin amount before minimum pegin height")
246+
self.log.info("check min peg-in amount before minimum peg-in height")
247247
assert_equal(sidechain.getblockchaininfo()["blocks"], PEGIN_MINIMUM_HEIGHT - 1)
248248
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5)
249249
pegin_txid = sidechain.claimpegin(bitcoin_txhex, txoutproof, claim_script)
@@ -267,11 +267,11 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
267267
assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT)
268268
assert_equal(result["pegin_subsidy_active"], False)
269269

270-
self.log.info("check min pegin amount after minimum pegin height")
270+
self.log.info("check min peg-in amount after minimum peg-in height")
271271
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5)
272272
assert_raises_rpc_error(
273273
-4,
274-
"Pegin amount (0.50) is lower than the minimum pegin amount for this chain (1.00).",
274+
"Peg-in amount (0.50) is lower than the minimum peg-in amount for this chain (1.00).",
275275
sidechain.claimpegin,
276276
bitcoin_txhex,
277277
txoutproof,
@@ -436,7 +436,7 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
436436
signed["hex"],
437437
)
438438

439-
self.log.info("blinded pegin above threshold, with validatepegin")
439+
self.log.info("blinded peg-in above threshold, with validatepegin")
440440
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=2.0, feerate=1.0)
441441
addr = sidechain.getnewaddress(address_type="blech32")
442442
utxo = sidechain.listunspent()[0]
@@ -664,7 +664,7 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
664664
assert_equal(len(pegin_tx["decoded"]["vout"]), 3)
665665
assert_equal(pegin_tx["decoded"]["vout"][1]["value"], Decimal("0.00000396"))
666666

667-
# check manually constructed pegin from a sub 1 sat/vb parent
667+
# check manually constructed peg-in from a sub 1 sat/vb parent
668668
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=1, feerate=0.1)
669669
inputs = [
670670
{
@@ -798,20 +798,20 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
798798
sidechain.sendrawtransaction(signed["hex"])
799799
self.generate(sidechain2, 1, sync_fun=sync_sidechain)
800800

801-
# minimum pegin amount is 1.0
802-
self.log.info("claimpegin below minimum pegin amount")
801+
# minimum peg-in amount is 1.0
802+
self.log.info("claimpegin below minimum peg-in amount")
803803
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.99999999)
804804
assert_raises_rpc_error(
805805
-4,
806-
"Pegin amount (0.99999999) is lower than the minimum pegin amount for this chain (1.00).",
806+
"Peg-in amount (0.99999999) is lower than the minimum peg-in amount for this chain (1.00).",
807807
sidechain2.claimpegin,
808808
bitcoin_txhex,
809809
txoutproof,
810810
claim_script,
811811
)
812812

813-
# check minimum pegin amount in mempool validation by constructing manually
814-
self.log.info("rawtransaction below minimum pegin amount")
813+
# check minimum peg-in amount in mempool validation by constructing manually
814+
self.log.info("rawtransaction below minimum peg-in amount")
815815
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain2, amount=0.99999999)
816816
addr = sidechain2.getnewaddress()
817817
inputs = [
@@ -835,10 +835,10 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
835835
signed = sidechain2.signrawtransactionwithwallet(raw)
836836
assert_equal(signed["complete"], True)
837837
accept = sidechain2.testmempoolaccept([signed["hex"]])
838-
# node2 can check the min pegin amount as the pegin amount is in the witness
838+
# node2 can check the min peg-in amount as the peg-in amount is in the witness
839839
assert_equal(accept[0]["allowed"], False)
840840
assert_equal(accept[0]["reject-reason"], "pegin-value-too-low")
841-
# node1 rejects below the min pegin amount with validatepegin
841+
# node1 rejects below the min peg-in amount with validatepegin
842842
accept = sidechain.testmempoolaccept([signed["hex"]])
843843
assert_equal(accept[0]["allowed"], False)
844844
assert_equal(accept[0]["reject-reason"], "pegin-value-too-low")
@@ -860,7 +860,7 @@ def parent_pegin(parent, node, amount=1.0, feerate=DEFAULT_FEERATE):
860860
self.generate(sidechain, 1, sync_fun=sync_sidechain)
861861

862862
# dust error
863-
# restart node1 with no min pegin amount
863+
# restart node1 with no min peg-in amount
864864
self.stop_node(1, expected_stderr=self.expected_stderr) # when running with bitcoind as parent node this stderr can occur
865865
self.start_node(1, extra_args=sidechain.extra_args + ["-peginminamount=0"])
866866
self.log.info("claimpegin dust error")

0 commit comments

Comments
 (0)