diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index b9339d3b..5890fdc6 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -100,7 +100,7 @@ #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1 #define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 /* by default, blocks ids count in synchronizing */ -#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 /* by default, blocks count in blocks downloading */ +#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 100 /* by default, blocks count in blocks downloading */ #define CRYPTONOTE_MEMPOOL_TX_LIVETIME (86400*3) /* seconds, three days */ #define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 /* seconds, one week */ @@ -173,6 +173,8 @@ namespace config boost::uuids::uuid const NETWORK_ID = { { 0x22 ,0x36, 0xF1, 0x22 , 0x54, 0x86 , 0x37, 0xFF, 0xAB, 0x89, 0x01, 0x92, 0xAA, 0xBC, 0x2F, 0x16 } }; + std::string const GENESIS_TX = "011901ff0001ffffffffffff0102bca7c97f7074ea888eac572fda0964cc864baf7bc07d6cecc052728039009d7621017133140c2abc1825f8d411db7bee4379a2a0f21b7af60e44ed7f07f9e66ccd8800"; + uint32_t const GENESIS_NONCE = 10001; } namespace stagenet diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index ce1a1670..3f433a49 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -565,13 +565,13 @@ namespace cryptonote return construct_tx_and_get_tx_key(sender_account_keys, subaddresses, sources, destinations_copy, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys, false, false, NULL); } //--------------------------------------------------------------- - bool generate_genesis_block(block& bl) + bool generate_genesis_block(block& bl, network_type nettype) { //genesis block bl = boost::value_initialized(); blobdata tx_bl; - bool r = string_tools::parse_hexstr_to_binbuff(config::GENESIS_TX, tx_bl); + bool r = string_tools::parse_hexstr_to_binbuff(nettype == cryptonote::MAINNET ? config::GENESIS_TX : config::testnet::GENESIS_TX, tx_bl); CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob"); r = parse_and_validate_tx_from_blob(tx_bl, bl.miner_tx); CHECK_AND_ASSERT_MES(r, false, "failed to parse coinbase tx from hard coded blob"); diff --git a/src/cryptonote_core/cryptonote_tx_utils.h b/src/cryptonote_core/cryptonote_tx_utils.h index c31b968b..c20e9ecf 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.h +++ b/src/cryptonote_core/cryptonote_tx_utils.h @@ -94,7 +94,7 @@ namespace cryptonote bool construct_tx_with_tx_key(const account_keys& sender_account_keys, const std::unordered_map& subaddresses, std::vector& sources, const std::vector& destinations, const boost::optional& change_addr, std::vector extra, transaction& tx, uint64_t unlock_time, const crypto::secret_key &tx_key, const std::vector &additional_tx_keys, bool rct = false, bool bulletproof = false, rct::multisig_out *msout = NULL); bool construct_tx_and_get_tx_key(const account_keys& sender_account_keys, const std::unordered_map& subaddresses, std::vector& sources, const std::vector& destinations, const boost::optional& change_addr, std::vector extra, transaction& tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector &additional_tx_keys, bool rct = false, bool bulletproof = false, rct::multisig_out *msout = NULL); - bool generate_genesis_block(block& bl); + bool generate_genesis_block(block& bl, network_type nettype); } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c332a1c9..3a2012ce 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3003,7 +3003,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string& } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); @@ -3062,7 +3062,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); @@ -3127,7 +3127,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string& } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); @@ -3177,7 +3177,7 @@ void wallet2::generate(const std::string& wallet_, const epee::wipeable_string& } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); @@ -3217,7 +3217,7 @@ void wallet2::restore(const std::string& wallet_, const epee::wipeable_string& p if(!r) MERROR("String with address text not saved"); } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); if (!wallet_.empty()) { @@ -3313,7 +3313,7 @@ std::string wallet2::make_multisig(const epee::wipeable_string &password, } cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_blockchain.push_back(get_block_hash(b)); add_subaddress_account(tr("Primary account")); @@ -3796,7 +3796,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass } cryptonote::block genesis; - generate_genesis(genesis); + generate_genesis(genesis, m_nettype); crypto::hash genesis_hash = get_block_hash(genesis); if (m_blockchain.empty()) @@ -4184,7 +4184,7 @@ void wallet2::rescan_blockchain(bool refresh) clear(); cryptonote::block genesis; - generate_genesis(genesis); + generate_genesis(genesis, m_nettype); crypto::hash genesis_hash = get_block_hash(genesis); m_blockchain.push_back(genesis_hash); add_subaddress_account(tr("Primary account")); @@ -5414,7 +5414,7 @@ bool wallet2::set_ring_database(const std::string &filename) try { cryptonote::block b; - generate_genesis(b); + generate_genesis(b, m_nettype); m_ringdb.reset(new tools::ringdb(m_ring_database, epee::string_tools::pod_to_hex(get_block_hash(b)))); } catch (const std::exception &e) @@ -8963,7 +8963,7 @@ void wallet2::import_blockchain(const std::tuple& subaddr_indices); void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set& subaddr_indices); - void generate_genesis(cryptonote::block& b) const; + void generate_genesis(cryptonote::block& b, cryptonote::network_type const& nettype) const; void check_genesis(const crypto::hash& genesis_hash) const; //throws bool generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const; crypto::hash get_payment_id(const pending_tx &ptx) const;