Skip to content

Commit

Permalink
fix: Changes to mainnet
Browse files Browse the repository at this point in the history
Changes back to mainnet from dpops-test.
  • Loading branch information
zachhildreth committed Mar 11, 2022
2 parents 56b8963 + 2834e2a commit 30b35b4
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 767 deletions.
1 change: 1 addition & 0 deletions src/cryptonote_basic/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,3 +1067,4 @@ namespace cryptonote
return boost::logic::tribool(boost::logic::indeterminate);
}
}

42 changes: 21 additions & 21 deletions src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@


// Seed Nodes
#define SEED_NODE_1 "us1.xcash.foundation:18280"
#define SEED_NODE_2 "europe1.xcash.foundation:18280"
#define SEED_NODE_3 "europe2.xcash.foundation:18280"
#define SEED_NODE_4 "europe3.xcash.foundation:18280"
#define SEED_NODE_5 "oceania1.xcash.foundation:18280"
#define SEED_NODE_1 "dpops-test-1.xcash.foundation:18280"
#define SEED_NODE_2 "dpops-test-2.xcash.foundation:18280"
#define SEED_NODE_3 "dpops-test-3.xcash.foundation:18280"
#define SEED_NODE_4 "dpops-test-4.xcash.foundation:18280"
#define SEED_NODE_5 "dpops-test-5.xcash.foundation:18280"

/*#define SEED_NODE_1 "192.168.1.201:18280"
#define SEED_NODE_2 "192.168.1.202:18280"
Expand All @@ -216,8 +216,8 @@ full_addrs.insert(SEED_NODE_5);
// XCASH DPOPS

// Blockchain
#define HF_VERSION_PROOF_OF_STAKE 13
#define HF_BLOCK_HEIGHT_PROOF_OF_STAKE 800000 // The first block of the X-CASH proof of stake
#define HF_VERSION_PROOF_OF_STAKE 14
#define HF_BLOCK_HEIGHT_PROOF_OF_STAKE 880000 // The first block of the X-CASH proof of stake
#define BLOCK_TIME 5 // the block time in minutes
#define BLOCKS_PER_DAY_FIVE_MINUTE_BLOCK_TIME 288 // The blocks per day with a 5 minute block time
#define MAXIMUM_RESERVE_BYTES_LEGNTH 4096 // The maximum size in bytes for the reserve bytes in the block header
Expand Down Expand Up @@ -248,28 +248,28 @@ full_addrs.insert(SEED_NODE_5);

// XCASH DPOPS
#define BLOCK_VERIFIERS_TOTAL_AMOUNT 100 // The total amount of block verifiers
#define BLOCK_VERIFIERS_AMOUNT 50 // The amount of block verifiers in a round
#define BLOCK_VERIFIERS_VALID_AMOUNT 27 // The amount of block verifiers that need to vote true for the part of the round to be valid.
#define BLOCK_VERIFIERS_AMOUNT 30 // The amount of block verifiers in a round
#define BLOCK_VERIFIERS_VALID_AMOUNT 17 // The amount of block verifiers that need to vote true for the part of the round to be valid.
#define BLOCK_VERIFIERS_VALID_AMOUNT_PERCENTAGE 0.55 // The amount of block verifiers in a percentage that need to vote true for the part of the round to be valid.


// Updates data
#define BLOCK_HEIGHT_SF_V_2_1_0 8000000 // stealth address verification
#define BLOCK_HEIGHT_SF_V_2_1_0 895300 // stealth address verification


// Network data nodes
#define NETWORK_DATA_NODES_AMOUNT 5 // The amount of network data nodes

#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_1 "XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_2 "XCA1YhckQgqGQvMsS2xi4n3cHBPo39WYFC1AXskqaFB87Q6EX5LheKK6E3ZqQmD9CDFX8br8Mfvff7RqT6UcuUja46qKC1vEJb"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_3 "XCA1c2ahjRvBsp35ynTknNYczj9y42hN9ht1vNyns2FCTU4qbLqahtsTw2E7JTKLd3ecSGLe2zWJgCiwrMhecsbT38i3Smy9vW"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_4 "XCA1jN7CNCKEN1kDuqxiuUPyKWiVp68RsYxshdohaQ1k8NN11ZWX9dSJv3hx6qxfPaKVAnet4LTda9fsK81c9wRN5Aj78KyZEg"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_5 "XCA1hKDayQXECEA5Yja4a8CU6Suoo9XT9jET7Ng2Rx2z3fLsGy5iVQCL9hWWTi3TroJxihWY4j84n9WMJvpFvagW5hMNpq1jh9"
#define NETWORK_DATA_NODE_IP_ADDRESS_1 "us1.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_2 "europe1.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_3 "europe2.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_4 "europe3.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_5 "oceania1.xcash.foundation"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_1 "XCA1Sk2CRVQ9EoKzkv2mnzfAwgA4zvj2HfXJrzYYCtJAdLXDPuSr1UGEJPKSTGCan9fmNpqTGefkMGZ4JX3zUf357vm5VMzMir"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_2 "XCA1tDjMy6UCGfC5tCpRF6U7NZNFWrSdMbF9FrE4HdoXHGRSr3NJgHdicsdV6c6tsvRU2NmGYsAGf19VNWVhkrL73XH3AKx9Dw"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_3 "XCA1sLyHMW23w238zJdZJVWVfMZMYyMxW9ypPVSLyduk7Ee4UtCbXMG7yJzqaT7vP24jq4ceC5F8PFTjPZEYTrKb6DdfbaLTAa"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_4 "XCA1dYZmCGMFnmYppTHtWoQNB168NAjHmiU9WdWsB4mXiytoHiMyrYqYYBcHwewiLhYj6eij4r8BRSScNYphZRtz8RajVriGZC"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_5 "XCA1rgiYYcY1k37GBiWz5PiUbB7SzvVGqPiLoBCyHdmAN8hfs47N7ZzFWZrJsTy8Lj4QKh1fFLdr2SNVebqimW7j24J9dsWBhM"
#define NETWORK_DATA_NODE_IP_ADDRESS_1 "dpops-test-1.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_2 "dpops-test-2.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_3 "dpops-test-3.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_4 "dpops-test-4.xcash.foundation"
#define NETWORK_DATA_NODE_IP_ADDRESS_5 "dpops-test-5.xcash.foundation"

/*#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_1 "XCA1pEWxj2q7gn7TJjae7JfsDhtnhydxsHhtADhDm4LbdE11rHVZqbX5MPGZ9tM7jQbDF4VKK89jSAqgL9Nxxjdh8RM5JEpZZP"
#define NETWORK_DATA_NODE_PUBLIC_ADDRESS_2 "XCA1VSDHKCc4Qhvqb3fquebSYxfMeyGteQeAYtDSpaTcgquBY1bkKWtQ42tZG2w7Ak7GyqnaiTgWL4bMHE9Lwd2A3g2Recxz7B"
Expand Down Expand Up @@ -321,7 +321,7 @@ namespace config
uint16_t const RPC_DEFAULT_PORT = 18281;
uint16_t const ZMQ_RPC_DEFAULT_PORT = 18282;
boost::uuids::uuid const NETWORK_ID = { {
0x10 ,0x10, 0x41, 0x53 , 0x48, 0x62 , 0x41, 0x65, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10
0x10 ,0x11, 0x41, 0x52 , 0x48, 0x62 , 0x25, 0x65, 0x17, 0x31, 0x00, 0x82, 0x35, 0xA1, 0xA1, 0x10
} };
std::string const GENESIS_TX = "013c01ff0001b197bcc5c605029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd0880712101f1dde8d8d6c53e9d2e920d6e66432eaff6a85b2d25043fc29ef477b075b143df";
uint32_t const GENESIS_NONCE = 10000;
Expand Down
6 changes: 6 additions & 0 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4083,6 +4083,12 @@ bool get_network_block_database_hash(std::vector<std::string> &block_verifiers_d
// send the message to a random network data node
for (count = 0; string.find("|") == std::string::npos && count < NETWORK_DATA_NODES_AMOUNT; count++)
{
// check if they need to reset the network_data_nodes_array
if (network_data_nodes_array[NETWORK_DATA_NODES_AMOUNT-1] != 0)
{
std::fill(network_data_nodes_array, network_data_nodes_array+NETWORK_DATA_NODES_AMOUNT, 0);
}

do
{
// get a random network data node
Expand Down
14 changes: 1 addition & 13 deletions src/cryptonote_core/cryptonote_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,7 @@ namespace cryptonote
virtual void on_transaction_relayed(const cryptonote::blobdata& tx);


/**
* @brief gets the miner instance
*
* @return a reference to the miner instance
*/
miner& get_miner(){return m_miner;}

/**
* @brief gets the miner instance (const)
*
* @return a const reference to the miner instance
*/
const miner& get_miner()const{return m_miner;}


/**
* @brief adds command line options to the given options set
Expand Down
106 changes: 0 additions & 106 deletions src/daemon/command_parser_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,112 +261,6 @@ bool t_command_parser_executor::print_transaction_pool_stats(const std::vector<s
return m_executor.print_transaction_pool_stats();
}

bool t_command_parser_executor::start_mining(const std::vector<std::string>& args)
{
if(!args.size())
{
std::cout << "Please specify a wallet address to mine for: start_mining <addr> [<threads>]" << std::endl;
return true;
}

cryptonote::address_parse_info info;
cryptonote::network_type nettype = cryptonote::MAINNET;
if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, args.front()))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, args.front()))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, args.front()))
{
bool dnssec_valid;
std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(args.front(), dnssec_valid,
[](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid){return addresses[0];});
if(!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, address_str))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::TESTNET, address_str))
{
if(!cryptonote::get_account_address_from_str(info, cryptonote::STAGENET, address_str))
{
std::cout << "target account address has wrong format" << std::endl;
return true;
}
else
{
nettype = cryptonote::STAGENET;
}
}
else
{
nettype = cryptonote::TESTNET;
}
}
}
else
{
nettype = cryptonote::STAGENET;
}
}
else
{
nettype = cryptonote::TESTNET;
}
}
if (info.is_subaddress)
{
tools::fail_msg_writer() << "subaddress for mining reward is not yet supported!" << std::endl;
return true;
}
if(nettype != cryptonote::MAINNET)
std::cout << "Mining to a " << (nettype == cryptonote::TESTNET ? "testnet" : "stagenet") << " address, make sure this is intentional!" << std::endl;
uint64_t threads_count = 1;
bool do_background_mining = false;
bool ignore_battery = false;
if(args.size() > 4)
{
return false;
}

if(args.size() == 4)
{
if(args[3] == "true" || command_line::is_yes(args[3]) || args[3] == "1")
{
ignore_battery = true;
}
else if(args[3] != "false" && !command_line::is_no(args[3]) && args[3] != "0")
{
return false;
}
}

if(args.size() >= 3)
{
if(args[2] == "true" || command_line::is_yes(args[2]) || args[2] == "1")
{
do_background_mining = true;
}
else if(args[2] != "false" && !command_line::is_no(args[2]) && args[2] != "0")
{
return false;
}
}

if(args.size() >= 2)
{
bool ok = epee::string_tools::get_xtype_from_string(threads_count, args[1]);
threads_count = (ok && 0 < threads_count) ? threads_count : 1;
}

m_executor.start_mining(info.address, threads_count, nettype, do_background_mining, ignore_battery);

return true;
}

bool t_command_parser_executor::stop_mining(const std::vector<std::string>& args)
{
if (!args.empty()) return false;

return m_executor.stop_mining();
}

bool t_command_parser_executor::stop_daemon(const std::vector<std::string>& args)
{
if (!args.empty()) return false;
Expand Down
4 changes: 0 additions & 4 deletions src/daemon/command_parser_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ class t_command_parser_executor final

bool print_transaction_pool_stats(const std::vector<std::string>& args);

bool start_mining(const std::vector<std::string>& args);

bool stop_mining(const std::vector<std::string>& args);

bool stop_daemon(const std::vector<std::string>& args);

bool print_status(const std::vector<std::string>& args);
Expand Down
11 changes: 0 additions & 11 deletions src/daemon/command_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,6 @@ t_command_server::t_command_server(
, "is_key_image_spent <key_image>"
, "Print whether a given key image is in the spent key images set."
);
m_command_lookup.set_handler(
"start_mining"
, std::bind(&t_command_parser_executor::start_mining, &m_parser, p::_1)
, "start_mining <addr> [<threads>] [do_background_mining] [ignore_battery]"
, "Start mining for specified address. Defaults to 1 thread and no background mining."
);
m_command_lookup.set_handler(
"stop_mining"
, std::bind(&t_command_parser_executor::stop_mining, &m_parser, p::_1)
, "Stop mining."
);
m_command_lookup.set_handler(
"print_pool"
, std::bind(&t_command_parser_executor::print_transaction_pool_long, &m_parser, p::_1)
Expand Down
2 changes: 0 additions & 2 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ bool t_daemon::run(bool interactive)

for(auto& rpc : mp_internals->rpcs)
rpc->stop();
mp_internals->core.get().get_miner().stop();
MGINFO("Node stopped.");
return true;
}
Expand All @@ -220,7 +219,6 @@ void t_daemon::stop()
{
throw std::runtime_error{"Can't stop stopped daemon"};
}
mp_internals->core.get().get_miner().stop();
mp_internals->p2p.stop();
for(auto& rpc : mp_internals->rpcs)
rpc->stop();
Expand Down
60 changes: 0 additions & 60 deletions src/daemon/rpc_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,6 @@ bool t_rpc_command_executor::show_status() {
tools::fail_msg_writer() << make_error(fail_message, hfres.status);
return true;
}
if (!m_rpc_server->on_mining_status(mreq, mres))
{
tools::fail_msg_writer() << fail_message.c_str();
return true;
}

if (mres.status == CORE_RPC_STATUS_BUSY)
{
Expand Down Expand Up @@ -1071,61 +1066,6 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
return true;
}

bool t_rpc_command_executor::start_mining(cryptonote::account_public_address address, uint64_t num_threads, cryptonote::network_type nettype, bool do_background_mining, bool ignore_battery) {
cryptonote::COMMAND_RPC_START_MINING::request req;
cryptonote::COMMAND_RPC_START_MINING::response res;
req.miner_address = cryptonote::get_account_address_as_str(nettype, false, address);
req.threads_count = num_threads;
req.do_background_mining = do_background_mining;
req.ignore_battery = ignore_battery;

std::string fail_message = "Mining did not start";

if (m_is_rpc)
{
if (m_rpc_client->rpc_request(req, res, "/start_mining", fail_message.c_str()))
{
tools::success_msg_writer() << "Mining started";
}
}
else
{
if (!m_rpc_server->on_start_mining(req, res) || res.status != CORE_RPC_STATUS_OK)
{
tools::fail_msg_writer() << make_error(fail_message, res.status);
return true;
}
}

return true;
}

bool t_rpc_command_executor::stop_mining() {
cryptonote::COMMAND_RPC_STOP_MINING::request req;
cryptonote::COMMAND_RPC_STOP_MINING::response res;

std::string fail_message = "Mining did not stop";

if (m_is_rpc)
{
if (!m_rpc_client->rpc_request(req, res, "/stop_mining", fail_message.c_str()))
{
return true;
}
}
else
{
if (!m_rpc_server->on_stop_mining(req, res) || res.status != CORE_RPC_STATUS_OK)
{
tools::fail_msg_writer() << make_error(fail_message, res.status);
return true;
}
}

tools::success_msg_writer() << "Mining stopped";
return true;
}

bool t_rpc_command_executor::stop_daemon()
{
cryptonote::COMMAND_RPC_STOP_DAEMON::request req;
Expand Down
4 changes: 0 additions & 4 deletions src/daemon/rpc_command_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ class t_rpc_command_executor final {

bool print_transaction_pool_stats();

bool start_mining(cryptonote::account_public_address address, uint64_t num_threads, cryptonote::network_type nettype, bool do_background_mining = false, bool ignore_battery = false);

bool stop_mining();

bool stop_daemon();

bool print_status();
Expand Down
12 changes: 6 additions & 6 deletions src/debug_utilities/object_sizes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ int main(int argc, char* argv[])
SL(tools::wallet2::unsigned_tx_set);
SL(tools::wallet2::signed_tx_set);

SL(X-CASH::WalletImpl);
SL(X-CASH::AddressBookRow);
SL(X-CASH::TransactionInfoImpl);
SL(X-CASH::TransactionHistoryImpl);
SL(X-CASH::PendingTransactionImpl);
SL(X-CASH::UnsignedTransactionImpl);
SL(XCash::WalletImpl);
SL(XCash::AddressBookRow);
SL(XCash::TransactionInfoImpl);
SL(XCash::TransactionHistoryImpl);
SL(XCash::PendingTransactionImpl);
SL(XCash::UnsignedTransactionImpl);

return 0;
}
Loading

0 comments on commit 30b35b4

Please sign in to comment.