// Copyright (c) 2026 The Limenka developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef LIMENKA_NODE_BLUKECOIN_H #define LIMENKA_NODE_BLUKECOIN_H #include #include #include #include #include #include class CBlockHeader; class CService; namespace Consensus { struct Params; } namespace node { //! A bitcoin-blake2b (blukecoin) node is a fork of the parent chain that //! keeps the parent's P2P identity (magic, port, genesis) but hashes block //! headers with blake2b instead of SHA256d. Its blocks can therefore never //! be validated on the parent chain, which is exactly how it is detected: //! a transmitted header whose claimed difficulty is within the mainnet //! powLimit range but whose SHA256d hash does not meet it is on a foreign //! hashing chain. class BlukecoinManager { public: //! Test a single header for the blake2b-chain signature. Returns //! std::nullopt when the header's nBits is outside the mainnet powLimit //! range (a low-work testnet fork, not blukecoin). static std::optional HeaderLooksBlake2b(const CBlockHeader& header, const Consensus::Params& params); //! Record a detected blukecoin node address (ip:port). void NoteDetected(const CService& addr); //! Whether the address is already known as a blukecoin node. bool IsKnown(const CService& addr) const; //! Snapshot of all known blukecoin node addresses. std::vector GetKnown() const; private: mutable Mutex m_mutex; std::set m_known GUARDED_BY(m_mutex); }; } // namespace node #endif // LIMENKA_NODE_BLUKECOIN_H