aboutsummaryrefslogtreecommitdiff
path: root/src/gen_multisig
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-02-16 20:04:04 +0900
committerstoffu <stoffu@protonmail.ch>2018-03-05 11:55:05 +0900
commitaf773211cbc620a1be54f517bd60e587d58a7e93 (patch)
tree40e747cbfc21c7182db27291fb29f9b033de2379 /src/gen_multisig
parentcommand_line: allow args to depend on more than one args (diff)
downloadmonero-af773211cbc620a1be54f517bd60e587d58a7e93.tar.xz
Stagenet
Diffstat (limited to '')
-rw-r--r--src/gen_multisig/gen_multisig.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gen_multisig/gen_multisig.cpp b/src/gen_multisig/gen_multisig.cpp
index 64204d8b9..9bcf4495c 100644
--- a/src/gen_multisig/gen_multisig.cpp
+++ b/src/gen_multisig/gen_multisig.cpp
@@ -72,11 +72,12 @@ namespace
const command_line::arg_descriptor<uint32_t> arg_participants = {"participants", genms::tr("How many participants wil share parts of the multisig wallet"), 0};
const command_line::arg_descriptor<uint32_t> arg_threshold = {"threshold", genms::tr("How many signers are required to sign a valid transaction"), 0};
const command_line::arg_descriptor<bool, false> arg_testnet = {"testnet", genms::tr("Create testnet multisig wallets"), false};
+ const command_line::arg_descriptor<bool, false> arg_stagenet = {"stagenet", genms::tr("Create stagenet multisig wallets"), false};
const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""};
}
-static bool generate_multisig(uint32_t threshold, uint32_t total, const std::string &basename, bool testnet)
+static bool generate_multisig(uint32_t threshold, uint32_t total, const std::string &basename, network_type nettype)
{
tools::msg_writer() << (boost::format(genms::tr("Generating %u %u/%u multisig wallets")) % total % threshold % total).str();
@@ -89,7 +90,7 @@ static bool generate_multisig(uint32_t threshold, uint32_t total, const std::str
for (size_t n = 0; n < total; ++n)
{
std::string name = basename + "-" + std::to_string(n + 1);
- wallets[n].reset(new tools::wallet2(testnet));
+ wallets[n].reset(new tools::wallet2(nettype));
wallets[n]->init("");
wallets[n]->generate(name, pwd_container->password(), rct::rct2sk(rct::skGen()), false, false);
}
@@ -149,7 +150,7 @@ static bool generate_multisig(uint32_t threshold, uint32_t total, const std::str
}
}
- std::string address = wallets[0]->get_account().get_public_address_str(wallets[0]->testnet());
+ std::string address = wallets[0]->get_account().get_public_address_str(wallets[0]->nettype());
tools::success_msg_writer() << genms::tr("Generated multisig wallets for address ") << address << std::endl << ss.str();
}
catch (const std::exception &e)
@@ -169,10 +170,11 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_threshold);
command_line::add_arg(desc_params, arg_participants);
command_line::add_arg(desc_params, arg_testnet);
+ command_line::add_arg(desc_params, arg_stagenet);
const auto vm = wallet_args::main(
argc, argv,
- "monero-gen-multisig [--testnet] [--filename-base=<filename>] [--scheme=M/N] [--threshold=M] [--participants=N]",
+ "monero-gen-multisig [(--testnet|--stagenet)] [--filename-base=<filename>] [--scheme=M/N] [--threshold=M] [--participants=N]",
genms::tr("This program generates a set of multisig wallets - use this simpler scheme only if all the participants trust each other"),
desc_params,
boost::program_options::positional_options_description(),
@@ -182,11 +184,17 @@ int main(int argc, char* argv[])
if (!vm)
return 1;
- bool testnet;
+ bool testnet, stagenet;
uint32_t threshold = 0, total = 0;
std::string basename;
testnet = command_line::get_arg(*vm, arg_testnet);
+ stagenet = command_line::get_arg(*vm, arg_stagenet);
+ if (testnet && stagenet)
+ {
+ tools::fail_msg_writer() << genms::tr("Error: Can't specify more than one of --testnet and --stagenet");
+ return 1;
+ }
if (command_line::has_arg(*vm, arg_scheme))
{
if (sscanf(command_line::get_arg(*vm, arg_scheme).c_str(), "%u/%u", &threshold, &total) != 2)
@@ -233,7 +241,7 @@ int main(int argc, char* argv[])
tools::fail_msg_writer() << genms::tr("Error: unsupported scheme: only N/N and N-1/N are supported");
return 1;
}
- if (!generate_multisig(threshold, total, basename, testnet))
+ if (!generate_multisig(threshold, total, basename, testnet ? TESTNET : stagenet ? STAGENET : MAINNET))
return 1;
return 0;