/* * This file is part of the Monero P2Pool * Copyright (c) 2021-2025 SChernykh * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once namespace p2pool { void merkle_hash(const std::vector& hashes, root_hash& root); void merkle_hash_full_tree(const std::vector& hashes, std::vector>& tree); bool merkle_hash_with_proof(const std::vector& hashes, const hash& hash_to_prove, std::vector& proof, uint32_t& path, root_hash& root); bool merkle_hash_with_proof(const std::vector& hashes, size_t index_to_prove, std::vector& proof, uint32_t& path, root_hash& root); bool get_merkle_proof(const std::vector>& tree, const hash& h, std::vector& proof, uint32_t& path); root_hash get_root_from_proof(hash h, const std::vector& proof, size_t index, size_t count); bool verify_merkle_proof(const hash& h, const std::vector& proof, size_t index, size_t count, const root_hash& root); bool verify_merkle_proof(hash h, const std::vector& proof, uint32_t path, const root_hash& root); uint32_t get_aux_slot(const hash &id, uint32_t nonce, uint32_t n_aux_chains); bool find_aux_nonce(const std::vector& aux_id, uint32_t& nonce, uint32_t max_nonce = 0xFFFF); size_t get_position_from_path(size_t count, uint32_t path); } // namespace p2pool