diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 93558cc..492b744 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -281,7 +281,7 @@ bool SideChain::fill_sidechain_data(PoolBlock& block, std::vector& s // Don't create genesis block until initial peer sync has been attempted // This prevents nodes from creating independent chains when starting simultaneously if (!m_precalcFinished.load()) { - P2PServer* p2p = m_pool->p2p_server(); + const P2PServer* p2p = m_pool->p2p_server(); if (p2p && (p2p->peer_list_size() > 0 || p2p->num_connections() > 0)) { LOGINFO(5, "Waiting for initial peer sync before creating genesis block"); return false; @@ -2769,7 +2769,7 @@ void SideChain::purge_sidechain() WriteLock lock(m_sidechainLock); // Free all block memory - for (auto& it : m_blocksById) { + for (const auto& it : m_blocksById) { delete it.second; } @@ -3075,7 +3075,7 @@ void SideChain::update_checkpoints(uint64_t new_height) } // Find the block at checkpoint height - PoolBlock* block = find_verified_block_at_height(checkpoint_height); + const PoolBlock* block = find_verified_block_at_height(checkpoint_height); if (block && block->m_verified) { Checkpoint cp; cp.height = checkpoint_height; diff --git a/src/wallet.cpp b/src/wallet.cpp index 2e77e9c..7e4e881 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -200,7 +200,6 @@ bool Wallet::decode(const char* address) // DEBUG: Print what we decoded { - static constexpr char log_category_prefix[] = "Wallet "; char spend_hex[65] = {0}, view_hex[65] = {0}, data_hex[200] = {0}, prefix_hex[20] = {0}; for (int i = 0; i < 32; i++) { sprintf(spend_hex + static_cast(i)*2, "%02x", m_spendPublicKey.h[i]); @@ -292,11 +291,11 @@ void Wallet::encode(char (&buf)[ADDRESS_LENGTH]) const int data_index = 0; // Write prefix as varint - uint64_t prefix = m_prefix; + uint64_t addr_prefix = m_prefix; do { - data[data_index++] = static_cast((prefix & 0x7F) | (prefix > 0x7F ? 0x80 : 0)); - prefix >>= 7; - } while (prefix); + data[data_index++] = static_cast((addr_prefix & 0x7F) | (addr_prefix > 0x7F ? 0x80 : 0)); + addr_prefix >>= 7; + } while (addr_prefix); // Write public keys memcpy(data + data_index, m_spendPublicKey.h, HASH_SIZE); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f685c07..e0810bc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -67,6 +67,7 @@ set(SOURCES ../external/src/hardforks/hardforks.cpp ../src/block_cache.cpp ../src/block_template.cpp + ../src/carrot_crypto.cpp ../src/crypto.cpp ../src/keccak.cpp ../src/log.cpp @@ -79,6 +80,7 @@ set(SOURCES ../src/params.cpp ../src/pool_block.cpp ../src/pow_hash.cpp + ../src/protocol_tx_hash.cpp ../src/side_chain.cpp ../src/stratum_server.cpp ../src/tcp_server.cpp