当前位置: 首页>>代码示例>>C++>>正文


C++ data_buffer::read_uint64方法代码示例

本文整理汇总了C++中data_buffer::read_uint64方法的典型用法代码示例。如果您正苦于以下问题:C++ data_buffer::read_uint64方法的具体用法?C++ data_buffer::read_uint64怎么用?C++ data_buffer::read_uint64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data_buffer的用法示例。


在下文中一共展示了data_buffer::read_uint64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: decode

bool zerotime_lock::decode(data_buffer & buffer)
{
    /**
     * Decode the version.
     */
    m_version = buffer.read_uint32();

    assert(m_version == current_version);

    /**
     * Decode the transaction.
     */
    m_transaction.decode(buffer);

    /**
     * Decode the transaction hash.
     */
    buffer.read_bytes(
        reinterpret_cast<char *> (m_hash_tx.digest()), sha256::digest_length
    );

    assert(m_transaction.get_hash() == m_hash_tx);

    /**
     * Decode the expiration.
     */
    m_expiration = buffer.read_uint64();

    /**
     * Enforce the expiration.
     */
    if (
        m_expiration < time::instance().get_adjusted() + interval_min_expire ||
        m_expiration > time::instance().get_adjusted() + interval_max_expire
    )
    {
        m_expiration = time::instance().get_adjusted() + interval_min_expire;
    }

    /**
     * No signature is required because:
     * 1. The receiver may want to lock a non-zerotime transaction.
     * 2. It causes no harm to let other's lock the transaction.
     * 3. It conserves bandwidth and processing power.
     */

    return m_transaction.get_hash() == m_hash_tx;
}
开发者ID:tempbottle,项目名称:vanillacoin,代码行数:48,代码来源:zerotime_lock.cpp

示例2: read_key_value


//.........这里部分代码省略.........
                    wtx.from_account().size()
                );
                
                wtx.set_time_received_is_tx_time(tmp);
            }
            else
            {
                wtx.set_time_received_is_tx_time(0);
            }
            
            wallet_upgrade.push_back(hash);
        }

        if (wtx.order_position() == -1)
        {
            any_unordered = true;
        }
    }
    else if (type == "acentry")
    {
        std::string acct;
        
        auto len = buffer_key.read_var_int();
        
        if (len > 0)
        {
            acct.resize(len);
            
            buffer_key.read_bytes(
                const_cast<char *> (acct.data()), acct.size()
            );
        }
        
        std::uint64_t entry_number = buffer_key.read_uint64();
        
        if (entry_number > g_accounting_entry_number)
        {
            g_accounting_entry_number = entry_number;
        }
        
        if (any_unordered == false)
        {
            accounting_entry entry;
            
            entry.decode(buffer_value);
            
            if (entry.order_position() == -1)
            {
                any_unordered = true;
            }
        }
    }
    else if (type == "key" || type == "wkey")
    {
        std::vector<std::uint8_t> pub_key;
        
        auto len_public_key = buffer_key.read_var_int();
        
        if (len_public_key > 0)
        {
            pub_key.resize(len_public_key);
            
            buffer_key.read_bytes(
                reinterpret_cast<char *>(&pub_key[0]), pub_key.size()
            );
        }
开发者ID:tempbottle,项目名称:vanillacoin,代码行数:67,代码来源:db_wallet.cpp

示例3: decode

bool incentive_collaterals::decode(data_buffer & buffer)
{
    /**
     * Decode the version.
     */
    m_version = buffer.read_uint32();
    
    assert(m_version == current_version);
    
    /**
     * Read the number of collateral entries.
     */
    auto count = buffer.read_var_int();
    
    /**
     * Read each collateral entry.
     */
    for (auto i = 0; i < count; i++)
    {
        address_manager::recent_endpoint_t collateral;
        
        /**
         * Read the address.
         */
        collateral.addr = buffer.read_network_address(false, true);
        
        auto len = buffer.read_var_int();
        
        collateral.wallet_address.resize(len);
        
        /**
         * Read the wallet address.
         */
        buffer.read_bytes(
            const_cast<char *> (collateral.wallet_address.data()),
            collateral.wallet_address.size()
        );
        
        /**
         * Read the public key.
         */
        collateral.public_key.decode(buffer);
        
        /**
         * Read the transaction_in.
         */
        collateral.tx_in.decode(buffer);
        
        /**
         * Read the time.
         */
        collateral.time = buffer.read_uint64();
        
        /**
         * Read the protocol version.
         */
        collateral.protocol_version = buffer.read_uint32();
        
        /**
         * Read the protocol version user agent length.
         */
        len = buffer.read_var_int();
        
        collateral.protocol_version_user_agent.resize(len);
        
        /**
         * Read the protocol version user agent.
         */
        buffer.read_bytes(
            const_cast<char *> (collateral.protocol_version_user_agent.data()),
            collateral.protocol_version_user_agent.size()
        );
        
        /**
         * Read the protocol version services.
         */
        collateral.protocol_version_services = buffer.read_uint64();
        
        /**
         * Read the protocol version start height.
         */
        collateral.protocol_version_start_height = buffer.read_int32();
        
        m_collaterals.insert(collateral);
    }
    
    return true;
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:88,代码来源:incentive_collaterals.cpp


注:本文中的data_buffer::read_uint64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。