diff --git a/src/chainparams.cpp b/src/chainparams.cpp index e3490d57f8..1eb76a4cb7 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -977,7 +977,7 @@ protected: pegin_subsidy = ParsePeginSubsidy(args); pegin_minimum = ParsePeginMinimum(args); if (pegin_subsidy.threshold < pegin_minimum.amount) { - 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))); + 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))); } // Calculate pegged Bitcoin asset @@ -1228,7 +1228,7 @@ public: pegin_subsidy = ParsePeginSubsidy(args); pegin_minimum = ParsePeginMinimum(args); if (pegin_subsidy.threshold < pegin_minimum.amount) { - 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))); + 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))); } parentGenesisBlockHash = uint256S("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); @@ -1593,7 +1593,7 @@ public: pegin_subsidy = ParsePeginSubsidy(args); pegin_minimum = ParsePeginMinimum(args); if (pegin_subsidy.threshold < pegin_minimum.amount) { - 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))); + 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))); } if (args.IsArgSet("-parentgenesisblockhash")) { diff --git a/src/init.cpp b/src/init.cpp index d1d8db2bf9..d8dd3dca73 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -629,7 +629,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-mainchainrpcpassword=", "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); argsman.AddArg("-mainchainrpccookiefile=", "The bitcoind cookie auth path which the daemon will use to connect to the trusted mainchain daemon to validate peg-ins. (default: `/regtest/.cookie`)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS); argsman.AddArg("-mainchainrpctimeout=", strprintf("Timeout in seconds during mainchain RPC requests, or 0 for no timeout. (default: %d)", DEFAULT_HTTP_CLIENT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS); - argsman.AddArg("-peginconfirmationdepth=", strprintf("Pegin claims must be this deep to be considered valid. (default: %d)", DEFAULT_PEGIN_CONFIRMATION_DEPTH), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS); + argsman.AddArg("-peginconfirmationdepth=", strprintf("Peg-in claims must be this deep to be considered valid. (default: %d)", DEFAULT_PEGIN_CONFIRMATION_DEPTH), ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS); 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); 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); 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) if (gArgs.GetBoolArg("-validatepegin", Params().GetConsensus().has_parent_chain)) { uiInterface.InitMessage(_("Awaiting mainchain RPC warmup").translated); if (!MainchainRPCCheck()) { - 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"; + 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"; // We fail immediately if this node has RPC server enabled if (gArgs.GetBoolArg("-server", false)) { InitError(Untranslated(err_msg)); @@ -1979,7 +1979,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) gArgs.SoftSetArg("-validatepegin", "0"); } } - // if we are validating pegin subsidy or minimum then we require bitcoind >= v25 + // if we are validating peg-in subsidy or minimum then we require bitcoind >= v25 if (Params().GetPeginSubsidy().IsDefined() || Params().GetPeginMinimum().IsDefined()) { UniValue params(UniValue::VARR); UniValue reply = CallMainChainRPC("getnetworkinfo", params); @@ -1990,7 +1990,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) const int version = reply["result"]["version"].get_int(); const std::string& subversion = reply["result"]["subversion"].get_str(); if (version < 250000 && subversion.find("Satoshi") != std::string::npos) { - const std::string err = strprintf("ERROR: parent bitcoind must be version 25 or newer for pegin subsidy/minimum validation. Found version: %s", version); + const std::string err = strprintf("ERROR: parent bitcoind must be version 25 or newer for peg-in subsidy/minimum validation. Found version: %s", version); InitError(Untranslated(err)); return false; } diff --git a/src/wallet/rpc/elements.cpp b/src/wallet/rpc/elements.cpp index 93aab0b02d..0f0f0c7cdd 100644 --- a/src/wallet/rpc/elements.cpp +++ b/src/wallet/rpc/elements.cpp @@ -453,7 +453,7 @@ RPCHelpMan initpegoutwallet() RPCHelpMan sendtomainchain_base() { return RPCHelpMan{"sendtomainchain", - "\nSends sidechain funds to the given mainchain address, through the federated pegin mechanism\n" + "\nSends sidechain funds to the given mainchain address, through the federated peg-in mechanism\n" + wallet::HELP_REQUIRING_PASSPHRASE, { {"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 // Make the tx CMutableTransaction mtx; - // Construct pegin input + // Construct peg-in input CreatePegInInput(mtx, 0, txBTCRef, merkleBlock, claim_scripts, txData, txOutProofData, wallet->chain().getTip()); // Get value for peg-in output CAmount value = 0; if (!GetAmountFromParentChainPegin(value, *txBTCRef, mtx.vin[0].prevout.n)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to pegin must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex())); + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to peg-in must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex())); } const PeginMinimum pegin_minimum = Params().GetPeginMinimum(); if (pwallet->chain().getTip()->nHeight >= pegin_minimum.height && value < pegin_minimum.amount) { - 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))); + 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))); } const PeginSubsidy pegin_subsidy = Params().GetPeginSubsidy(); @@ -985,7 +985,7 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef RPCHelpMan createrawpegin() { return RPCHelpMan{"createrawpegin", - "\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" + "\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" "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", { @@ -1035,7 +1035,7 @@ RPCHelpMan createrawpegin() RPCHelpMan claimpegin() { return RPCHelpMan{"claimpegin", - "\nClaim coins from the main chain by creating a pegin transaction with the necessary metadata after the corresponding Bitcoin transaction.\n" + "\nClaim coins from the main chain by creating a peg-in 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", { @@ -1097,7 +1097,7 @@ RPCHelpMan claimpegin() throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } - // To check if it's not double spending an existing pegin UTXO, we check mempool acceptance. + // To check if it's not double spending an existing peg-in UTXO, we check mempool acceptance. const MempoolAcceptResult res = pwallet->chain().testPeginClaimAcceptance(MakeTransactionRef(mtx)); if (res.m_result_type != MempoolAcceptResult::ResultType::VALID) { bilingual_str error = Untranslated(strprintf("Error: The transaction was rejected! Reason given: %s", res.m_state.ToString())); @@ -1303,7 +1303,7 @@ RPCHelpMan blindrawtransaction() for (size_t nIn = 0; nIn < tx.vin.size(); ++nIn) { COutPoint prevout = tx.vin[nIn].prevout; - // Special handling for pegin inputs: no blinds and explicit amount/asset. + // Special handling for peg-in inputs: no blinds and explicit amount/asset. if (tx.vin[nIn].m_is_pegin) { std::string err; if (tx.witness.vtxinwit.size() != tx.vin.size() || !IsValidPeginWitness(tx.witness.vtxinwit[nIn].m_pegin_witness, fedpegscripts, prevout, err, false)) { diff --git a/test/functional/feature_pegin_subsidy.py b/test/functional/feature_pegin_subsidy.py index 695cae0935..020622bde7 100755 --- a/test/functional/feature_pegin_subsidy.py +++ b/test/functional/feature_pegin_subsidy.py @@ -243,7 +243,7 @@ class PeginSubsidyTest(BitcoinTestFramework): assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT) assert_equal(result["pegin_subsidy_active"], False) - self.log.info("check min pegin amount before minimum pegin height") + self.log.info("check min peg-in amount before minimum peg-in height") assert_equal(sidechain.getblockchaininfo()["blocks"], PEGIN_MINIMUM_HEIGHT - 1) txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5) pegin_txid = sidechain.claimpegin(bitcoin_txhex, txoutproof, claim_script) @@ -267,11 +267,11 @@ class PeginSubsidyTest(BitcoinTestFramework): assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT) assert_equal(result["pegin_subsidy_active"], False) - self.log.info("check min pegin amount after minimum pegin height") + self.log.info("check min peg-in amount after minimum peg-in height") txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5) assert_raises_rpc_error( -4, - "Pegin amount (0.50) is lower than the minimum pegin amount for this chain (1.00).", + "Peg-in amount (0.50) is lower than the minimum peg-in amount for this chain (1.00).", sidechain.claimpegin, bitcoin_txhex, txoutproof, @@ -436,7 +436,7 @@ class PeginSubsidyTest(BitcoinTestFramework): signed["hex"], ) - self.log.info("blinded pegin above threshold, with validatepegin") + self.log.info("blinded peg-in above threshold, with validatepegin") txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=2.0, feerate=1.0) addr = sidechain.getnewaddress(address_type="blech32") utxo = sidechain.listunspent()[0] @@ -664,7 +664,7 @@ class PeginSubsidyTest(BitcoinTestFramework): assert_equal(len(pegin_tx["decoded"]["vout"]), 3) assert_equal(pegin_tx["decoded"]["vout"][1]["value"], Decimal("0.00000396")) - # check manually constructed pegin from a sub 1 sat/vb parent + # check manually constructed peg-in from a sub 1 sat/vb parent txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=1, feerate=0.1) inputs = [ { @@ -798,20 +798,20 @@ class PeginSubsidyTest(BitcoinTestFramework): sidechain.sendrawtransaction(signed["hex"]) self.generate(sidechain2, 1, sync_fun=sync_sidechain) - # minimum pegin amount is 1.0 - self.log.info("claimpegin below minimum pegin amount") + # minimum peg-in amount is 1.0 + self.log.info("claimpegin below minimum peg-in amount") txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.99999999) assert_raises_rpc_error( -4, - "Pegin amount (0.99999999) is lower than the minimum pegin amount for this chain (1.00).", + "Peg-in amount (0.99999999) is lower than the minimum peg-in amount for this chain (1.00).", sidechain2.claimpegin, bitcoin_txhex, txoutproof, claim_script, ) - # check minimum pegin amount in mempool validation by constructing manually - self.log.info("rawtransaction below minimum pegin amount") + # check minimum peg-in amount in mempool validation by constructing manually + self.log.info("rawtransaction below minimum peg-in amount") txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain2, amount=0.99999999) addr = sidechain2.getnewaddress() inputs = [ @@ -835,10 +835,10 @@ class PeginSubsidyTest(BitcoinTestFramework): signed = sidechain2.signrawtransactionwithwallet(raw) assert_equal(signed["complete"], True) accept = sidechain2.testmempoolaccept([signed["hex"]]) - # node2 can check the min pegin amount as the pegin amount is in the witness + # node2 can check the min peg-in amount as the peg-in amount is in the witness assert_equal(accept[0]["allowed"], False) assert_equal(accept[0]["reject-reason"], "pegin-value-too-low") - # node1 rejects below the min pegin amount with validatepegin + # node1 rejects below the min peg-in amount with validatepegin accept = sidechain.testmempoolaccept([signed["hex"]]) assert_equal(accept[0]["allowed"], False) assert_equal(accept[0]["reject-reason"], "pegin-value-too-low") @@ -860,7 +860,7 @@ class PeginSubsidyTest(BitcoinTestFramework): self.generate(sidechain, 1, sync_fun=sync_sidechain) # dust error - # restart node1 with no min pegin amount + # restart node1 with no min peg-in amount self.stop_node(1, expected_stderr=self.expected_stderr) # when running with bitcoind as parent node this stderr can occur self.start_node(1, extra_args=sidechain.extra_args + ["-peginminamount=0"]) self.log.info("claimpegin dust error")