Skip to content
Snippets Groups Projects
Select Git revision
  • 3a49eca827996d9ccd8515a8a8aa111fd200e407
  • main default protected
  • release/1.1
  • encrypt_comments
  • mnemonic_dewif
  • authors_rules
  • 0.14
  • rtd
  • 1.2.1 protected
  • 1.2.0 protected
  • 1.1.1 protected
  • 1.1.0 protected
  • 1.0.0 protected
  • 1.0.0rc1 protected
  • 1.0.0rc0 protected
  • 1.0.0-rc protected
  • 0.62.0 protected
  • 0.61.0 protected
  • 0.60.1 protected
  • 0.58.1 protected
  • 0.60.0 protected
  • 0.58.0 protected
  • 0.57.0 protected
  • 0.56.0 protected
  • 0.55.1 protected
  • 0.55.0 protected
  • 0.54.3 protected
  • 0.54.2 protected
28 results

send_membership.py

Blame
    • Vincent Texier's avatar
      3a49eca8
      [enh] #95 refactor Document.signatures (List) as Document.signature (str)... · 3a49eca8
      Vincent Texier authored
      [enh] #95 refactor Document.signatures (List) as Document.signature (str) (break backward compatibility)
      
      Transaction can have multiple signatures, with Transaction.signatures attribute and Transaction.multi_sign([keys]) method.
      
      verifying_key.py is refactored heavily to avoid circular reference:
      * method VerifyingKey.verify_document() removed, use Document.check_signature(pubkey) or Transaction.check_signatures(pubkeys) instead
      * method VerifyingKey.verify_ws2p_head() is removed, use Document.check_signature(pubkey) instead.
      3a49eca8
      History
      [enh] #95 refactor Document.signatures (List) as Document.signature (str)...
      Vincent Texier authored
      [enh] #95 refactor Document.signatures (List) as Document.signature (str) (break backward compatibility)
      
      Transaction can have multiple signatures, with Transaction.signatures attribute and Transaction.multi_sign([keys]) method.
      
      verifying_key.py is refactored heavily to avoid circular reference:
      * method VerifyingKey.verify_document() removed, use Document.check_signature(pubkey) or Transaction.check_signatures(pubkeys) instead
      * method VerifyingKey.verify_ws2p_head() is removed, use Document.check_signature(pubkey) instead.
    lib.rs 3.03 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/>.
    
    //! BlockChain Datas Access Layer in Read-Only mode.
    
    #![allow(clippy::large_enum_variant)]
    #![deny(
        missing_docs,
        missing_copy_implementations,
        trivial_casts,
        trivial_numeric_casts,
        unsafe_code,
        unstable_features,
        unused_import_braces,
        unused_qualifications
    )]
    
    pub mod blocks;
    pub mod constants;
    pub mod currency_params;
    pub mod current_meta_datas;
    pub mod indexes;
    pub mod paging;
    pub mod tools;
    
    pub use durs_dbs_tools::kv_db::{
        KvFileDbRead as DbReadable, KvFileDbRoHandler as BcDbRo, KvFileDbSchema, KvFileDbStoreType,
        KvFileDbValue as DbValue, Readable as Reader,
    };
    
    use constants::*;
    use durs_dbs_tools::DbError;
    use maplit::hashmap;
    use std::path::Path;
    
    #[inline]
    /// Get BlockChain DB Schema
    pub fn bc_db_schema() -> KvFileDbSchema {
        KvFileDbSchema {
            stores: hashmap![
                CURRENT_METAS_DATAS.to_owned() => KvFileDbStoreType::SingleIntKey,
                MAIN_BLOCKS.to_owned() => KvFileDbStoreType::SingleIntKey,
                FORK_BLOCKS.to_owned() => KvFileDbStoreType::Single,
                ORPHAN_BLOCKSTAMP.to_owned() => KvFileDbStoreType::Single,
                IDENTITIES.to_owned() => KvFileDbStoreType::Single,
            ],
        }
    }
    
    /// Open database
    #[inline]
    pub fn open_db_ro(path: &Path) -> Result<BcDbRo, DbError> {
        BcDbRo::open_db_ro(path, &bc_db_schema())
    }
    
    ///////////////////////////
    // Migration in progress //
    ///////////////////////////
    
    /// Certifications sorted by created block
    pub type CertsExpirV10Datas = fnv::FnvHashMap<
        dubp_common_doc::BlockNumber,
        std::collections::HashSet<(durs_wot::WotId, durs_wot::WotId)>,
    >;
    
    /// V10 Balances accounts
    pub type BalancesV10Datas = std::collections::HashMap<
        dubp_user_docs::documents::transaction::UTXOConditionsGroup,
        (
            crate::indexes::sources::SourceAmount,
            std::collections::HashSet<dubp_indexes::sindex::UniqueIdUTXOv10>,
        ),
    >;
    
    #[cfg(test)]
    pub mod tests {
    
        use super::*;
        use durs_dbs_tools::kv_db::KvFileDbHandler;
        use tempfile::tempdir;
    
        #[inline]
        /// Open database in an arbitrary temporary directory given by OS
        /// and automatically cleaned when `Db` is dropped
        pub fn open_tmp_db() -> Result<KvFileDbHandler, DbError> {
            KvFileDbHandler::open_db(
                tempdir().map_err(DbError::FileSystemError)?.path(),
                &bc_db_schema(),
            )
        }
    }