diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 544dfaa241..627b1fdabb 100755 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -300,22 +300,22 @@ uint64_t Blockchain::get_current_blockchain_height(bool lock) const //------------------------------------------------------------------ bool Blockchain::load_missing_blocks_into_beldex_subsystems() { - uint64_t const snl_height = std::max(hard_fork_begins(m_nettype, network_version_9_master_nodes).value_or(0), m_master_node_list.height() + 1); + uint64_t const mnl_height = std::max(hard_fork_begins(m_nettype, network_version_9_master_nodes).value_or(0), m_master_node_list.height() + 1); uint64_t const bns_height = std::max(hard_fork_begins(m_nettype, network_version_18_bns).value_or(0), m_bns_db.height() + 1); uint64_t const end_height = m_db->height(); - uint64_t const start_height = std::min(end_height, std::min(bns_height, snl_height)); - + uint64_t const start_height = std::min(end_height, std::min(bns_height, mnl_height)); + int64_t const total_blocks = static_cast(end_height) - static_cast(start_height); if (total_blocks <= 0) return true; if (total_blocks > 1) - MGINFO("Loading blocks into beldex subsystems, scanning blockchain from height: " << start_height << " to: " << end_height << " (snl: " << snl_height << ", bns: " << bns_height << ")"); + MGINFO("Loading blocks into beldex subsystems, scanning blockchain from height: " << start_height << " to: " << end_height << " (mnl: " << mnl_height << ", bns: " << bns_height << ")"); using clock = std::chrono::steady_clock; using work_time = std::chrono::duration; int64_t constexpr BLOCK_COUNT = 1000; auto work_start = clock::now(); auto scan_start = work_start; - work_time bns_duration{}, snl_duration{}, bns_iteration_duration{}, snl_iteration_duration{}; + work_time bns_duration{}, mnl_duration{}, bns_iteration_duration{}, mnl_iteration_duration{}; std::vector blocks; std::vector txs; @@ -330,7 +330,7 @@ bool Blockchain::load_missing_blocks_into_beldex_subsystems() { m_master_node_list.store(); auto duration = work_time{clock::now() - work_start}; - MGINFO("... scanning height " << start_height + (index * BLOCK_COUNT) << " (" << duration.count() << "s) (snl: " << snl_iteration_duration.count() << "s; bns: " << bns_iteration_duration.count() << "s)"); + MGINFO("... scanning height " << start_height + (index * BLOCK_COUNT) << " (" << duration.count() << "s) (mnl: " << mnl_iteration_duration.count() << "s; bns: " << bns_iteration_duration.count() << "s)"); #ifdef ENABLE_SYSTEMD // Tell systemd that we're doing something so that it should let us continue starting up // (giving us 120s until we have to send the next notification): @@ -339,8 +339,8 @@ bool Blockchain::load_missing_blocks_into_beldex_subsystems() work_start = clock::now(); bns_duration += bns_iteration_duration; - snl_duration += snl_iteration_duration; - bns_iteration_duration = snl_iteration_duration = {}; + mnl_duration += mnl_iteration_duration; + bns_iteration_duration = mnl_iteration_duration = {}; } blocks.clear(); @@ -363,9 +363,9 @@ bool Blockchain::load_missing_blocks_into_beldex_subsystems() return false; } - if (block_height >= snl_height) + if (block_height >= mnl_height) { - auto snl_start = clock::now(); + auto mnl_start = clock::now(); checkpoint_t *checkpoint_ptr = nullptr; checkpoint_t checkpoint; @@ -378,7 +378,7 @@ bool Blockchain::load_missing_blocks_into_beldex_subsystems() MFATAL("Unable to process block {} for updating master node list: " << e.what()); return false; } - snl_iteration_duration += clock::now() - snl_start; + mnl_iteration_duration += clock::now() - mnl_start; } if (m_bns_db.db && (block_height >= bns_height)) @@ -397,7 +397,7 @@ bool Blockchain::load_missing_blocks_into_beldex_subsystems() if (total_blocks > 1) { auto duration = work_time{clock::now() - scan_start}; - MGINFO("Done recalculating beldex subsystems (" << duration.count() << "s) (snl: " << snl_duration.count() << "s; bns: " << bns_duration.count() << "s)"); + MGINFO("Done recalculating beldex subsystems (" << duration.count() << "s) (mnl: " << mnl_duration.count() << "s; bns: " << bns_duration.count() << "s)"); } if (total_blocks > 0) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 0d3f7fb457..c6dc8a071a 100755 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -498,9 +498,9 @@ namespace cryptonote // Returns the master nodes info std::shared_ptr core::get_my_mn_info() const { - auto& snl = get_master_node_list(); + auto& mnl = get_master_node_list(); const auto& pubkey = get_master_keys().pub; - auto states = snl.get_master_node_list_state({ pubkey }); + auto states = mnl.get_master_node_list_state({ pubkey }); if (states.empty()) return nullptr; else @@ -523,9 +523,9 @@ namespace cryptonote s += "no"; else { - auto& snl = get_master_node_list(); + auto& mnl = get_master_node_list(); const auto& pubkey = get_master_keys().pub; - auto states = snl.get_master_node_list_state({ pubkey }); + auto states = mnl.get_master_node_list_state({ pubkey }); if (states.empty()) s += "not registered"; else @@ -539,7 +539,7 @@ namespace cryptonote s += "decomm."; uint64_t last_proof = 0; - snl.access_proof(pubkey, [&](auto& proof) { last_proof = proof.timestamp; }); + mnl.access_proof(pubkey, [&](auto& proof) { last_proof = proof.timestamp; }); s += ", proof: "; time_t now = std::time(nullptr); s += time_ago_str(now, last_proof); @@ -2393,7 +2393,7 @@ namespace cryptonote m_master_node_vote_relayer.do_call([this] { return relay_master_node_votes(); }); m_check_disk_space_interval.do_call([this] { return check_disk_space(); }); m_block_rate_interval.do_call([this] { return check_block_rate(); }); - m_mn_proof_cleanup_interval.do_call([&snl=m_master_node_list] { snl.cleanup_proofs(); return true; }); + m_mn_proof_cleanup_interval.do_call([&mnl=m_master_node_list] { mnl.cleanup_proofs(); return true; }); std::chrono::seconds lifetime{time(nullptr) - get_start_time()}; if (m_master_node && lifetime > get_net_config().UPTIME_PROOF_STARTUP_DELAY) // Give us some time to connect to peers before sending uptimes diff --git a/src/cryptonote_core/master_node_list.cpp b/src/cryptonote_core/master_node_list.cpp index 4912bb8f01..8d467dbdc8 100755 --- a/src/cryptonote_core/master_node_list.cpp +++ b/src/cryptonote_core/master_node_list.cpp @@ -3308,12 +3308,12 @@ namespace master_nodes return result; } - master_node_list::state_t::state_t(master_node_list* snl, state_serialized &&state) + master_node_list::state_t::state_t(master_node_list* mnl, state_serialized &&state) : height{state.height} , key_image_blacklist{std::move(state.key_image_blacklist)} , only_loaded_quorums{state.only_stored_quorums} , block_hash{state.block_hash} - , mn_list{snl} + , mn_list{mnl} { if (!mn_list) throw std::logic_error("Cannot deserialize a state_t without a master_node_list"); diff --git a/src/cryptonote_core/master_node_list.h b/src/cryptonote_core/master_node_list.h index 58e15812e3..44f7f53de2 100755 --- a/src/cryptonote_core/master_node_list.h +++ b/src/cryptonote_core/master_node_list.h @@ -680,8 +680,8 @@ namespace master_nodes mutable quorum_manager quorums; // Mutable because we are allowed to (and need to) change it via std::set iterator master_node_list* mn_list; - state_t(master_node_list* snl) : mn_list{snl} {} - state_t(master_node_list* snl, state_serialized &&state); + state_t(master_node_list* mnl) : mn_list{mnl} {} + state_t(master_node_list* mnl, state_serialized &&state); friend bool operator<(const state_t &a, const state_t &b) { return a.height < b.height; } friend bool operator<(const state_t &s, block_height h) { return s.height < h; } diff --git a/src/cryptonote_core/tx_flash.cpp b/src/cryptonote_core/tx_flash.cpp index c89f4ef1bc..0eddf5a120 100755 --- a/src/cryptonote_core/tx_flash.cpp +++ b/src/cryptonote_core/tx_flash.cpp @@ -43,10 +43,10 @@ static void check_args(flash_tx::subquorum q, int position, const char *func_nam throw std::invalid_argument("Invalid voter position passed to " + std::string(func_name)); } -crypto::public_key flash_tx::get_mn_pubkey(subquorum q, int position, const master_node_list &snl) const { +crypto::public_key flash_tx::get_mn_pubkey(subquorum q, int position, const master_node_list &mnl) const { check_args(q, position, __func__); uint64_t qheight = quorum_height(q); - auto flash_quorum = snl.get_quorum(quorum_type::flash, qheight); + auto flash_quorum = mnl.get_quorum(quorum_type::flash, qheight); if (!flash_quorum) { // TODO FIXME XXX - we don't want a failure here; if this happens we need to go back into state // history to retrieve the state info. (Or maybe this can't happen?) @@ -86,8 +86,8 @@ bool flash_tx::add_signature(subquorum q, int position, bool approved, const cry } -bool flash_tx::add_signature(subquorum q, int position, bool approved, const crypto::signature &sig, const master_node_list &snl) { - return add_signature(q, position, approved, sig, get_mn_pubkey(q, position, snl)); +bool flash_tx::add_signature(subquorum q, int position, bool approved, const crypto::signature &sig, const master_node_list &mnl) { + return add_signature(q, position, approved, sig, get_mn_pubkey(q, position, mnl)); } bool flash_tx::add_prechecked_signature(subquorum q, int position, bool approved, const crypto::signature &sig) { diff --git a/src/cryptonote_core/tx_flash.h b/src/cryptonote_core/tx_flash.h index 4f3508eef7..775092dd90 100755 --- a/src/cryptonote_core/tx_flash.h +++ b/src/cryptonote_core/tx_flash.h @@ -120,7 +120,7 @@ class flash_tx { * present; true if the signature was accepted and stored; and throws a * `flash_tx::signature_verification_error` if the signature fails validation. */ - bool add_signature(subquorum q, int position, bool approved, const crypto::signature &sig, const master_nodes::master_node_list &snl); + bool add_signature(subquorum q, int position, bool approved, const crypto::signature &sig, const master_nodes::master_node_list &mnl); /** * Adds a signature for the given quorum and position without checking it for validity (i.e. @@ -162,7 +162,7 @@ class flash_tx { uint64_t quorum_height(subquorum q) const { return quorum_height(height, q); } /// Returns the pubkey of the referenced master node, or null if there is no such master node. - crypto::public_key get_mn_pubkey(subquorum q, int position, const master_nodes::master_node_list &snl) const; + crypto::public_key get_mn_pubkey(subquorum q, int position, const master_nodes::master_node_list &mnl) const; /// Returns the hashed signing value for this flash TX for a tx with status `approved`. The /// result is a fast hash of the height + tx hash + approval value. Lock not required. diff --git a/src/cryptonote_protocol/quorumnet.cpp b/src/cryptonote_protocol/quorumnet.cpp index 10be9eb6f9..7bcc4e8d11 100755 --- a/src/cryptonote_protocol/quorumnet.cpp +++ b/src/cryptonote_protocol/quorumnet.cpp @@ -593,7 +593,7 @@ std::enable_if_t::value, I> get_or(bt_dict &d, const std::st // input quorum checksum matches the computed checksum for the quorums (if provided), otherwise sets // the given output checksum (if provided) to the calculated value. Throws std::runtime_error on // failure. -quorum_array get_flash_quorums(uint64_t flash_height, const master_node_list &snl, const uint64_t *input_checksum, uint64_t *output_checksum = nullptr) { +quorum_array get_flash_quorums(uint64_t flash_height, const master_node_list &mnl, const uint64_t *input_checksum, uint64_t *output_checksum = nullptr) { // We currently just use two quorums, Q and Q' in the whitepaper, but this code is designed to // work fine with more quorums (but don't use a single subquorum; that could only be secure or // reliable but not both). @@ -604,7 +604,7 @@ quorum_array get_flash_quorums(uint64_t flash_height, const master_node_list &sn auto height = flash_tx::quorum_height(flash_height, static_cast(qi)); if (!height) throw std::runtime_error("too early in blockchain to create a quorum"); - result[qi] = snl.get_quorum(quorum_type::flash, height); + result[qi] = mnl.get_quorum(quorum_type::flash, height); if (!result[qi]) throw std::runtime_error("failed to obtain a flash quorum"); auto &v = result[qi]->validators;