mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
grammar: prefer peg-in to pegin in messages
This commit is contained in:
parent
90b2b3bbb0
commit
a18a88b31b
4 changed files with 28 additions and 28 deletions
|
|
@ -977,7 +977,7 @@ protected:
|
||||||
pegin_subsidy = ParsePeginSubsidy(args);
|
pegin_subsidy = ParsePeginSubsidy(args);
|
||||||
pegin_minimum = ParsePeginMinimum(args);
|
pegin_minimum = ParsePeginMinimum(args);
|
||||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
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
|
// Calculate pegged Bitcoin asset
|
||||||
|
|
@ -1228,7 +1228,7 @@ public:
|
||||||
pegin_subsidy = ParsePeginSubsidy(args);
|
pegin_subsidy = ParsePeginSubsidy(args);
|
||||||
pegin_minimum = ParsePeginMinimum(args);
|
pegin_minimum = ParsePeginMinimum(args);
|
||||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
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");
|
parentGenesisBlockHash = uint256S("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
|
||||||
|
|
@ -1593,7 +1593,7 @@ public:
|
||||||
pegin_subsidy = ParsePeginSubsidy(args);
|
pegin_subsidy = ParsePeginSubsidy(args);
|
||||||
pegin_minimum = ParsePeginMinimum(args);
|
pegin_minimum = ParsePeginMinimum(args);
|
||||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
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")) {
|
if (args.IsArgSet("-parentgenesisblockhash")) {
|
||||||
|
|
|
||||||
|
|
@ -629,7 +629,7 @@ void SetupServerArgs(ArgsManager& argsman)
|
||||||
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);
|
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);
|
||||||
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);
|
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);
|
||||||
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);
|
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);
|
||||||
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);
|
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);
|
||||||
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("-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("-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);
|
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)) {
|
if (gArgs.GetBoolArg("-validatepegin", Params().GetConsensus().has_parent_chain)) {
|
||||||
uiInterface.InitMessage(_("Awaiting mainchain RPC warmup").translated);
|
uiInterface.InitMessage(_("Awaiting mainchain RPC warmup").translated);
|
||||||
if (!MainchainRPCCheck()) {
|
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
|
// We fail immediately if this node has RPC server enabled
|
||||||
if (gArgs.GetBoolArg("-server", false)) {
|
if (gArgs.GetBoolArg("-server", false)) {
|
||||||
InitError(Untranslated(err_msg));
|
InitError(Untranslated(err_msg));
|
||||||
|
|
@ -1979,7 +1979,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||||
gArgs.SoftSetArg("-validatepegin", "0");
|
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()) {
|
if (Params().GetPeginSubsidy().IsDefined() || Params().GetPeginMinimum().IsDefined()) {
|
||||||
UniValue params(UniValue::VARR);
|
UniValue params(UniValue::VARR);
|
||||||
UniValue reply = CallMainChainRPC("getnetworkinfo", params);
|
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 int version = reply["result"]["version"].get_int();
|
||||||
const std::string& subversion = reply["result"]["subversion"].get_str();
|
const std::string& subversion = reply["result"]["subversion"].get_str();
|
||||||
if (version < 250000 && subversion.find("Satoshi") != std::string::npos) {
|
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));
|
InitError(Untranslated(err));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -453,7 +453,7 @@ RPCHelpMan initpegoutwallet()
|
||||||
RPCHelpMan sendtomainchain_base()
|
RPCHelpMan sendtomainchain_base()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{"sendtomainchain",
|
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,
|
+ wallet::HELP_REQUIRING_PASSPHRASE,
|
||||||
{
|
{
|
||||||
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination address on Bitcoin mainchain"},
|
{"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
|
// Make the tx
|
||||||
CMutableTransaction mtx;
|
CMutableTransaction mtx;
|
||||||
|
|
||||||
// Construct pegin input
|
// Construct peg-in input
|
||||||
CreatePegInInput(mtx, 0, txBTCRef, merkleBlock, claim_scripts, txData, txOutProofData, wallet->chain().getTip());
|
CreatePegInInput(mtx, 0, txBTCRef, merkleBlock, claim_scripts, txData, txOutProofData, wallet->chain().getTip());
|
||||||
|
|
||||||
// Get value for peg-in output
|
// Get value for peg-in output
|
||||||
CAmount value = 0;
|
CAmount value = 0;
|
||||||
if (!GetAmountFromParentChainPegin(value, *txBTCRef, mtx.vin[0].prevout.n)) {
|
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();
|
const PeginMinimum pegin_minimum = Params().GetPeginMinimum();
|
||||||
if (pwallet->chain().getTip()->nHeight >= pegin_minimum.height && value < pegin_minimum.amount) {
|
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();
|
const PeginSubsidy pegin_subsidy = Params().GetPeginSubsidy();
|
||||||
|
|
@ -985,7 +985,7 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
|
||||||
RPCHelpMan createrawpegin()
|
RPCHelpMan createrawpegin()
|
||||||
{
|
{
|
||||||
return 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"
|
"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",
|
"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()
|
RPCHelpMan claimpegin()
|
||||||
{
|
{
|
||||||
return 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"
|
"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",
|
"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");
|
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));
|
const MempoolAcceptResult res = pwallet->chain().testPeginClaimAcceptance(MakeTransactionRef(mtx));
|
||||||
if (res.m_result_type != MempoolAcceptResult::ResultType::VALID) {
|
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()));
|
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) {
|
for (size_t nIn = 0; nIn < tx.vin.size(); ++nIn) {
|
||||||
COutPoint prevout = tx.vin[nIn].prevout;
|
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) {
|
if (tx.vin[nIn].m_is_pegin) {
|
||||||
std::string err;
|
std::string err;
|
||||||
if (tx.witness.vtxinwit.size() != tx.vin.size() || !IsValidPeginWitness(tx.witness.vtxinwit[nIn].m_pegin_witness, fedpegscripts, prevout, err, false)) {
|
if (tx.witness.vtxinwit.size() != tx.vin.size() || !IsValidPeginWitness(tx.witness.vtxinwit[nIn].m_pegin_witness, fedpegscripts, prevout, err, false)) {
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ class PeginSubsidyTest(BitcoinTestFramework):
|
||||||
assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT)
|
assert_equal(result["pegin_subsidy_height"], PEGIN_SUBSIDY_HEIGHT)
|
||||||
assert_equal(result["pegin_subsidy_active"], False)
|
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)
|
assert_equal(sidechain.getblockchaininfo()["blocks"], PEGIN_MINIMUM_HEIGHT - 1)
|
||||||
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5)
|
||||||
pegin_txid = sidechain.claimpegin(bitcoin_txhex, txoutproof, claim_script)
|
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_height"], PEGIN_SUBSIDY_HEIGHT)
|
||||||
assert_equal(result["pegin_subsidy_active"], False)
|
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)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.5)
|
||||||
assert_raises_rpc_error(
|
assert_raises_rpc_error(
|
||||||
-4,
|
-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,
|
sidechain.claimpegin,
|
||||||
bitcoin_txhex,
|
bitcoin_txhex,
|
||||||
txoutproof,
|
txoutproof,
|
||||||
|
|
@ -436,7 +436,7 @@ class PeginSubsidyTest(BitcoinTestFramework):
|
||||||
signed["hex"],
|
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)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=2.0, feerate=1.0)
|
||||||
addr = sidechain.getnewaddress(address_type="blech32")
|
addr = sidechain.getnewaddress(address_type="blech32")
|
||||||
utxo = sidechain.listunspent()[0]
|
utxo = sidechain.listunspent()[0]
|
||||||
|
|
@ -664,7 +664,7 @@ class PeginSubsidyTest(BitcoinTestFramework):
|
||||||
assert_equal(len(pegin_tx["decoded"]["vout"]), 3)
|
assert_equal(len(pegin_tx["decoded"]["vout"]), 3)
|
||||||
assert_equal(pegin_tx["decoded"]["vout"][1]["value"], Decimal("0.00000396"))
|
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)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=1, feerate=0.1)
|
||||||
inputs = [
|
inputs = [
|
||||||
{
|
{
|
||||||
|
|
@ -798,20 +798,20 @@ class PeginSubsidyTest(BitcoinTestFramework):
|
||||||
sidechain.sendrawtransaction(signed["hex"])
|
sidechain.sendrawtransaction(signed["hex"])
|
||||||
self.generate(sidechain2, 1, sync_fun=sync_sidechain)
|
self.generate(sidechain2, 1, sync_fun=sync_sidechain)
|
||||||
|
|
||||||
# minimum pegin amount is 1.0
|
# minimum peg-in amount is 1.0
|
||||||
self.log.info("claimpegin below minimum pegin amount")
|
self.log.info("claimpegin below minimum peg-in amount")
|
||||||
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.99999999)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain, amount=0.99999999)
|
||||||
assert_raises_rpc_error(
|
assert_raises_rpc_error(
|
||||||
-4,
|
-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,
|
sidechain2.claimpegin,
|
||||||
bitcoin_txhex,
|
bitcoin_txhex,
|
||||||
txoutproof,
|
txoutproof,
|
||||||
claim_script,
|
claim_script,
|
||||||
)
|
)
|
||||||
|
|
||||||
# check minimum pegin amount in mempool validation by constructing manually
|
# check minimum peg-in amount in mempool validation by constructing manually
|
||||||
self.log.info("rawtransaction below minimum pegin amount")
|
self.log.info("rawtransaction below minimum peg-in amount")
|
||||||
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain2, amount=0.99999999)
|
txid, vout, txoutproof, bitcoin_txhex, claim_script = parent_pegin(parent, sidechain2, amount=0.99999999)
|
||||||
addr = sidechain2.getnewaddress()
|
addr = sidechain2.getnewaddress()
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|
@ -835,10 +835,10 @@ class PeginSubsidyTest(BitcoinTestFramework):
|
||||||
signed = sidechain2.signrawtransactionwithwallet(raw)
|
signed = sidechain2.signrawtransactionwithwallet(raw)
|
||||||
assert_equal(signed["complete"], True)
|
assert_equal(signed["complete"], True)
|
||||||
accept = sidechain2.testmempoolaccept([signed["hex"]])
|
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]["allowed"], False)
|
||||||
assert_equal(accept[0]["reject-reason"], "pegin-value-too-low")
|
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"]])
|
accept = sidechain.testmempoolaccept([signed["hex"]])
|
||||||
assert_equal(accept[0]["allowed"], False)
|
assert_equal(accept[0]["allowed"], False)
|
||||||
assert_equal(accept[0]["reject-reason"], "pegin-value-too-low")
|
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)
|
self.generate(sidechain, 1, sync_fun=sync_sidechain)
|
||||||
|
|
||||||
# dust error
|
# 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.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.start_node(1, extra_args=sidechain.extra_args + ["-peginminamount=0"])
|
||||||
self.log.info("claimpegin dust error")
|
self.log.info("claimpegin dust error")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue