Skip to content
Snippets Groups Projects
Select Git revision
  • 3b487f7c69b6ddec30e1759dcecfb3e27c1dc458
  • master default protected
  • dyn-import
  • ipfs-QmXZQ7JCMiQVzUvyMXaQeJ9m8svZvwPNWX3q1UrUDfZ6Lj
  • ipfs-Qmbj6J9jrr5xmn4sCkdg2nr5TZikV7nJfSEDXEFawtfXpz
  • ipfs-QmR2YAUqVUKYQmYtBJEcTvYacMLVEwUaY678UHQafPXz5G
  • ipfs-QmbRo9ED4hoDiSGqXkBymeL9DFTmsW5wyueySLtrNsT6uZ
  • ipfs-QmTqgbRwgLDpJE1U5KdLwQmPNUF2F2FaR2JYNKpZ697qDZ
  • ipfs-QmaHnwqCnbcD7BDW5XgauS5sJ6vZea4EpgBXdM6xao87qW
  • ipfs-Qme1f16aCCzKD4mKehaW8hWg6P1NEGgHDQkSzJ9RRQXZoV
  • ipfs-QmancDvQKQ5PRtvVwa1H8joZehJBEyfDtz6M57SzRKHVe6
  • ipfs-QmUvmMy3iT2d6S82Zy6q1rGt2fgNaMXeHjjDvm3HWm3HL4
12 results

main.ts

Blame
  • Forked from Hugo Trentesaux / duniter-vue
    Source project has a limited visibility.
    current_frame.rs 12.58 KiB
    //  Copyright (C) 2017-2019  The AXIOM TEAM Association.
    //
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as
    // published by the Free Software Foundation, either version 3 of the
    // License, or (at your option) any later version.
    //
    // 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 Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    
    //! Current frame : Interval of blocks taken for the calculation of the personalized difficulty.
    
    //use crate::constants::*;
    use crate::*;
    
    extern crate num;
    
    use crate::current_meta_datas::get_current_blockstamp_;
    use current_meta_datas::CurrentMetaDataKey;
    use dubp_common_doc::BlockNumber;
    use durs_dbs_tools::DbError;
    use durs_wot::WotId;
    use num::Float;
    use rkv::store::integer::IntegerStore;
    use serde::de::DeserializeOwned;
    use serde::{Deserialize, Serialize};
    
    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
    /// Describe a member in current frame
    pub struct MemberInCurrentFrame {
        /// Number of blocks forged by the member in the current frame.
        pub forged_blocks: usize,
        /// Personal difficulty of the member.
        pub difficulty: PersonalDifficulty,
    }
    
    #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
    /// Personal difficulty of a member.
    pub struct PersonalDifficulty {
        /// Exclusion factor
        pub exclusion_factor: usize,
        /// handicap
        pub handicap: usize,
    }
    
    impl Default for PersonalDifficulty {
        fn default() -> Self {
            PersonalDifficulty {
                exclusion_factor: 1,
                handicap: 0,
            }
        }
    }
    
    #[derive(Debug, Copy, Clone, Serialize, Deserialize)]
    /// in frame member info data store
    pub struct MemberFrameInfo {
        last_personal_block_number: BlockNumber,
        last_personal_members_in_frame: usize,
        nb_personal_blocks_in_frame: usize,
        personal_difficulty: PersonalDifficulty,
    }
    //impl Default for MemberFrameInfo {
    //    fn default() -> Self {
    //        MemberFrameInfo {