working premine; empty first version of PROTOCOL_TX in block

This commit is contained in:
Some Random Crypto Guy
2023-10-18 10:48:16 +01:00
parent d186cf95c1
commit 0b3633ccdc
667 changed files with 8288 additions and 5019 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2014-2023, The Monero Project
# Copyright (c) 2014-2022, The Monero Project
#
# All rights reserved.
#
+10 -2
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
@@ -35,7 +35,7 @@
namespace daemon_args
{
std::string const WINDOWS_SERVICE_NAME = "Monero Daemon";
std::string const WINDOWS_SERVICE_NAME = "Fulmo Daemon";
const command_line::arg_descriptor<std::string, false, true, 2> arg_config_file = {
"config-file"
@@ -86,6 +86,10 @@ namespace daemon_args
"daemon_command"
, "Hidden"
};
const command_line::arg_descriptor<bool> arg_os_version = {
"os-version"
, "OS for which this executable was compiled"
};
const command_line::arg_descriptor<unsigned> arg_max_concurrency = {
"max-concurrency"
, "Max number of threads to use for a parallel job"
@@ -131,6 +135,10 @@ namespace daemon_args
"zmq-pub"
, "Address for ZMQ pub - tcp://ip:port or ipc://path"
};
const command_line::arg_descriptor<bool> arg_print_genesis_tx = {
"print-genesis-tx"
, "Print the genesis transaction"
};
const command_line::arg_descriptor<bool> arg_zmq_rpc_disabled = {
"no-zmq"
+3 -3
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
@@ -969,10 +969,10 @@ bool t_command_parser_executor::prune_blockchain(const std::vector<std::string>&
if (args.empty() || args[0] != "confirm")
{
std::cout << "Warning: pruning from within elbowd will not shrink the database file size." << std::endl;
std::cout << "Warning: pruning from within monerod will not shrink the database file size." << std::endl;
std::cout << "Instead, parts of the file will be marked as free, so the file will not grow" << std::endl;
std::cout << "until that newly free space is used up. If you want a smaller file size now," << std::endl;
std::cout << "exit elbowd and run monero-blockchain-prune (you will temporarily need more" << std::endl;
std::cout << "exit monerod and run monero-blockchain-prune (you will temporarily need more" << std::endl;
std::cout << "disk space for the database conversion though). If you are OK with the database" << std::endl;
std::cout << "file keeping the same size, re-run this command with the \"confirm\" parameter." << std::endl;
return true;
+1 -1
View File
@@ -6,7 +6,7 @@
*/
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -9,7 +9,7 @@ Passing RPC commands:
*/
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+71 -19
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
@@ -83,7 +83,7 @@ uint16_t parse_public_rpc_port(const po::variables_map &vm)
}
uint16_t rpc_port;
if (!epee::string_tools::get_xtype_from_string(rpc_port, rpc_port_str))
if (!string_tools::get_xtype_from_string(rpc_port, rpc_port_str))
{
throw std::runtime_error("invalid RPC port " + rpc_port_str);
}
@@ -122,6 +122,56 @@ bool isFat32(const wchar_t* root_path)
}
#endif
// Helper function to generate genesis transaction
void print_genesis_tx_hex(const cryptonote::network_type nettype) {
using namespace cryptonote;
account_base miner_acc1;
miner_acc1.generate();
//Create file with miner keys information
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
std::stringstream key_fine_name_ss;
key_fine_name_ss << "./miner01_keys" << std::put_time(&tm, "%Y%m%d%H%M%S") << ".dat";
std::string key_file_name = key_fine_name_ss.str();
std::ofstream miner_key_file;
miner_key_file.open (key_file_name);
miner_key_file << "Miner account address:" << std::endl;
miner_key_file << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
miner_key_file << std::endl<< "Miner spend secret key:" << std::endl;
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
miner_key_file << std::endl << "Miner view secret key:" << std::endl;
epee::to_hex::formatted(miner_key_file, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
miner_key_file << std::endl << std::endl;
miner_key_file.close();
//Prepare genesis_tx
cryptonote::transaction tx_genesis;
cryptonote::construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().m_account_address, tx_genesis, blobdata(), 999, 1);
std::cout << "Object:" << std::endl;
std::cout << obj_to_json_str(tx_genesis) << std::endl << std::endl;
std::cout << "Gennerating miner wallet..." << std::endl;
std::cout << "Miner account address:" << std::endl;
std::cout << cryptonote::get_account_address_as_str((network_type)nettype, false, miner_acc1.get_keys().m_account_address);
std::cout << std::endl << "Miner spend secret key:" << std::endl;
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_spend_secret_key));
std::cout << std::endl << "Miner view secret key:" << std::endl;
epee::to_hex::formatted(std::cout, epee::as_byte_span(miner_acc1.get_keys().m_view_secret_key));
std::cout << std::endl << std::endl;
std::stringstream ss;
binary_archive<true> ba(ss);
::serialization::serialize(ba, tx_genesis);
std::string tx_hex = ss.str();
std::cout << "Insert this line into your coin configuration file: " << std::endl;
std::cout << "std::string const GENESIS_TX = \"" << epee::string_tools::buff_to_hex_nodelimer(tx_hex) << "\";" << std::endl;
return;
}
int main(int argc, char const * argv[])
{
try {
@@ -143,6 +193,7 @@ int main(int argc, char const * argv[])
command_line::add_arg(visible_options, command_line::arg_help);
command_line::add_arg(visible_options, command_line::arg_version);
command_line::add_arg(visible_options, daemon_args::arg_os_version);
command_line::add_arg(visible_options, daemon_args::arg_config_file);
// Settings
@@ -158,7 +209,7 @@ int main(int argc, char const * argv[])
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
command_line::add_arg(core_settings, daemon_args::arg_zmq_pub);
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_disabled);
command_line::add_arg(core_settings, daemonizer::arg_non_interactive);
command_line::add_arg(core_settings, daemon_args::arg_print_genesis_tx);
daemonizer::init_options(hidden_options, visible_options);
daemonize::t_executor::init_options(core_settings);
@@ -190,7 +241,7 @@ int main(int argc, char const * argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Fulmo '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Usage: " + std::string{argv[0]} + " [options|settings] [daemon_command...]" << std::endl << std::endl;
std::cout << visible_options << std::endl;
return 0;
@@ -199,7 +250,21 @@ int main(int argc, char const * argv[])
// Monero Version
if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL;
std::cout << "Fulmo '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL;
return 0;
}
// OS
if (command_line::get_arg(vm, daemon_args::arg_os_version))
{
std::cout << "OS: " << tools::get_os_version_string() << ENDL;
return 0;
}
// OS
if (command_line::get_arg(vm, daemon_args::arg_print_genesis_tx))
{
print_genesis_tx_hex(cryptonote::MAINNET);
return 0;
}
@@ -212,19 +277,6 @@ int main(int argc, char const * argv[])
{
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
}
catch (const po::unknown_option &e)
{
std::string unrecognized_option = e.get_option_name();
if (all_options.find_nothrow(unrecognized_option, false))
{
std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl;
}
else
{
std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl;
}
return 1;
}
catch (const std::exception &e)
{
// log system isn't initialized yet
@@ -299,7 +351,7 @@ int main(int argc, char const * argv[])
tools::set_max_concurrency(command_line::get_arg(vm, daemon_args::arg_max_concurrency));
// logging is now set up
MGINFO("Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")");
MGINFO("Fulmo '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")");
// If there are positional options, we're running a daemon command
{
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
+9 -16
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//
@@ -644,14 +644,7 @@ bool t_rpc_command_executor::print_connections() {
}
}
auto longest_host = *std::max_element(res.connections.begin(), res.connections.end(),
[](const auto &info1, const auto &info2)
{
return info1.address.length() < info2.address.length();
});
int host_field_width = std::max(15, 8 + (int) longest_host.address.length());
tools::msg_writer() << std::setw(host_field_width) << std::left << "Remote Host"
tools::msg_writer() << std::setw(30) << std::left << "Remote Host"
<< std::setw(8) << "Type"
<< std::setw(6) << "SSL"
<< std::setw(20) << "Peer id"
@@ -668,11 +661,11 @@ bool t_rpc_command_executor::print_connections() {
for (auto & info : res.connections)
{
std::string address = info.incoming ? "INC " : "OUT ";
address += info.address;
address += info.ip + ":" + info.port;
//std::string in_out = info.incoming ? "INC " : "OUT ";
tools::msg_writer()
//<< std::setw(30) << std::left << in_out
<< std::setw(host_field_width) << std::left << address
<< std::setw(30) << std::left << address
<< std::setw(8) << (get_address_type_name((epee::net_utils::address_type)info.address_type))
<< std::setw(6) << (info.ssl ? "yes" : "no")
<< std::setw(20) << info.peer_id
@@ -782,7 +775,7 @@ bool t_rpc_command_executor::print_blockchain_info(int64_t start_block_index, ui
return true;
}
}
if ((uint64_t)-start_block_index >= ires.height)
if (start_block_index < 0 && (uint64_t)-start_block_index >= ires.height)
{
tools::fail_msg_writer() << "start offset is larger than blockchain height";
return true;
@@ -1070,7 +1063,7 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash,
cryptonote::blobdata blob;
std::string source = as_hex.empty() ? pruned_as_hex + prunable_as_hex : as_hex;
bool pruned = !pruned_as_hex.empty() && prunable_as_hex.empty();
if (!epee::string_tools::parse_hexstr_to_binbuff(source, blob))
if (!string_tools::parse_hexstr_to_binbuff(source, blob))
{
tools::fail_msg_writer() << "Failed to parse tx to get json format";
}
@@ -1466,10 +1459,10 @@ bool t_rpc_command_executor::print_status()
bool daemon_is_alive = m_rpc_client->check_connection();
if(daemon_is_alive) {
tools::success_msg_writer() << "elbowd is running";
tools::success_msg_writer() << "monerod is running";
}
else {
tools::fail_msg_writer() << "elbowd is NOT running";
tools::fail_msg_writer() << "monerod is NOT running";
}
return true;
@@ -2066,7 +2059,7 @@ bool t_rpc_command_executor::print_blockchain_dynamic_stats(uint64_t nblocks)
std::string fail_message = "Problem fetching info";
fereq.grace_blocks = 0;
hfreq.version = 1;
hfreq.version = HF_VERSION_PER_BYTE_FEE;
if (m_is_rpc)
{
if (!m_rpc_client->rpc_request(ireq, ires, "/getinfo", fail_message.c_str()))
+1 -1
View File
@@ -6,7 +6,7 @@
*/
// Copyright (c) 2014-2023, The Monero Project
// Copyright (c) 2014-2022, The Monero Project
//
// All rights reserved.
//