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


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

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


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

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