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


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

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


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

示例1: encode

void hd_configuration::encode(data_buffer & buffer) const
{
    assert(m_id_key_master.digest().size() == ripemd160::digest_length);
    buffer.write_uint32(m_version);
    buffer.write_uint32(m_index);
    buffer.write_bytes(
        reinterpret_cast<const char *> (&m_id_key_master.digest()[0]),
        ripemd160::digest_length
    );
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:10,代码来源:hd_configuration.cpp

示例2: encode

bool inventory_vector::encode(data_buffer & buffer)
{
    buffer.write_uint32(m_type);
    buffer.write_sha256(m_hash);
    
    return true;
}
开发者ID:jaggedMiner,项目名称:vanillacoin,代码行数:7,代码来源:inventory_vector.cpp

示例3: encode

void zerotime_lock::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);

    /**
     * Encode the transaction.
     */
    m_transaction.encode(buffer);

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

    /**
     * Encode the expiration.
     */
    buffer.write_uint64(m_expiration);

    /**
     * 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.
     */
}
开发者ID:tempbottle,项目名称:vanillacoin,代码行数:32,代码来源:zerotime_lock.cpp

示例4: encode

void chainblender_join::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);
    
    /**
     * The session id must be null for a cbjoin.
     */
    if (m_hash_session_id.is_empty() == false)
    {
        log_error(
            "ChainBlender join message has invalid hash session "
            "id = " << m_hash_session_id.to_string() << "."
        );
    }
    
    /**
     * Encode the session id.
     */
    buffer.write_sha256(m_hash_session_id);
    
    /**
     * Encode the denomination.
     */
    buffer.write_int64(m_denomination);
}
开发者ID:greenmo000,项目名称:vcash,代码行数:28,代码来源:chainblender_join.cpp

示例5: encode

void transaction::encode(
    data_buffer & buffer, const bool & encode_version
    ) const
{
    if (encode_version)
    {
        /**
         * Write the version.
         */
        buffer.write_uint32(m_version);
    }
    
    /**
     * Write the time.
     */
    buffer.write_uint32(m_time);
    
    /**
     * Write the m_transactions_in size.
     */
    buffer.write_var_int(m_transactions_in.size());
    
    for (auto & i : m_transactions_in)
    {
        i.encode(buffer);
    }
    
    /**
     * Write the m_transactions_out size.
     */
    buffer.write_var_int(m_transactions_out.size());
    
    for (auto & i : m_transactions_out)
    {
        i.encode(buffer);
    }
    
    /**
     * Write the time lock.
     */
    buffer.write_uint32(m_time_lock);
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:42,代码来源:transaction.cpp

示例6: encode

void key_wallet::encode(data_buffer & buffer)
{
    /**
     * Write the version.
     */
    buffer.write_uint32(constants::version_client);
    
    /**
     * Write the private key length.
     */
    buffer.write_var_int(m_key_private.size());
    
    /**
     * Write the private key.
     */
    if (m_key_private.size() > 0)
    {
        buffer.write_bytes(
            reinterpret_cast<const char *>(&m_key_private[0]),
            m_key_private.size()
        );
    }
    
    /**
     * Write the time created.
     */
    buffer.write_int64(m_time_created);
    
    /**
     * Write the time expires.
     */
    buffer.write_int64(m_time_expires);
    
    /**
     * Write the comment length.
     */
    buffer.write_var_int(m_comment.size());
    
    /**
     * Write the comment.
     */
    if (m_comment.size() > 0)
    {
        buffer.write_bytes(m_comment.data(), m_comment.size());
    }
}
开发者ID:machado-rev,项目名称:vcash,代码行数:46,代码来源:key_wallet.cpp

示例7: encode

void incentive_answer::encode(data_buffer & buffer, const bool & is_copy )
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);

    /**
     * Encode the public key.
     */
    m_public_key.encode(buffer);

    /**
     * Encode the transaction_in.
     */
    m_transaction_in.encode(buffer);

    /**
     * If we are encoding a copy reuse the existing signature.
     */
    if (is_copy == true)
    {
        /**
         * Write the signature length.
         */
        buffer.write_var_int(m_signature.size());
        
        /**
         * Write the signature.
         */
        buffer.write_bytes(
            reinterpret_cast<char *>(&m_signature[0]),
            m_signature.size()
        );
    }
    else
    {
        /**
         * Sign the message.
         */
        sign(buffer);
    }
}
开发者ID:machado-rev,项目名称:vcash,代码行数:43,代码来源:incentive_answer.cpp

示例8: encode

void key_pool::encode(data_buffer & buffer, const bool & include_version)
{
    if (include_version)
    {
        /**
         * Write the version.
         */
        buffer.write_uint32(constants::version_client);
    }
    
    /**
     * Write the time.
     */
    buffer.write_int64(m_time);
    
    /**
     * Encode the public key.
     */
    m_key_public.encode(buffer);
}
开发者ID:machado-rev,项目名称:vcash,代码行数:20,代码来源:key_pool.cpp

示例9: encode

void zerotime_question::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);
    
    /** 
     * Encode the transaction inputs length.
     */
    buffer.write_var_int(m_transactions_in.size());
    
    for (auto & i : m_transactions_in)
    {
        /**
         * Encode the transaction_in.
         */
        i.encode(buffer);
    }
}
开发者ID:greenmo000,项目名称:vcash,代码行数:20,代码来源:zerotime_question.cpp

示例10: encode

void merkle_tree_partial::encode(data_buffer & buffer)
{
    buffer.write_uint32(m_total_transactions);
    buffer.write_var_int(m_hashes.size());
    
    for (auto & i : m_hashes)
    {
        buffer.write_sha256(i);
    }
    
    std::vector<std::uint8_t> bytes;
    
    bytes.resize((m_flags.size() + 7) / 8);
    
    for (auto i = 0; i < m_flags.size(); i++)
    {
        bytes[i / 8] |= m_flags[i] << (i % 8);
    }
    
    buffer.write_var_int(bytes.size());
    buffer.write_bytes(
        reinterpret_cast<const char *> (&bytes[0]), bytes.size()
    );
}
开发者ID:rafaelfelicio,项目名称:vcash-1,代码行数:24,代码来源:merkle_tree_partial.cpp

示例11: encode

void incentive_collaterals::encode(data_buffer & buffer)
{
    /**
     * Encode the version.
     */
    buffer.write_uint32(m_version);
    
    /**
     * Write the number of collateral entries.
     */
    buffer.write_var_int(m_collaterals.size());
    
    /**
     * Write the collateral entries.
     */
     for (auto & i : m_collaterals)
     {
        /**
         * Write the address.
         */
        buffer.write_network_address(i.addr, false);
        
        /**
         * Write the size of the wallet address.
         */
        buffer.write_var_int(i.wallet_address.size());
        
        /**
         * Write the wallet address.
         */
        buffer.write_bytes(i.wallet_address.data(), i.wallet_address.size());
        
        auto public_key = i.public_key;
        
        /**
         * Write the public key.
         */
        public_key.encode(buffer);
        
        /**
         * Write the transaction_in.
         */
        i.tx_in.encode(buffer);
        
        /**
         * Write the time.
         */
        buffer.write_uint64(i.time);
        
        /**
         * Write the protocol version.
         */
        buffer.write_uint32(i.protocol_version);
        
        /**
         * Write the protocol user agent.
         */
        buffer.write_var_int(i.protocol_version_user_agent.size());
        
        /**
         * Write the protocol version user agent.
         */
        buffer.write_bytes(
            i.protocol_version_user_agent.data(),
            i.protocol_version_user_agent.size()
        );
        
        /**
         * Write the protocol version services.
         */
        buffer.write_uint64(i.protocol_version_services);
        
        /**
         * Write the protocol version start height.
         */
        buffer.write_int32(i.protocol_version_start_height);
     }
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:78,代码来源:incentive_collaterals.cpp

示例12: encode

void incentive_vote::encode(data_buffer & buffer, const bool & is_copy)
{
    /**
     * Write the version.
     */
    buffer.write_uint32(m_version);
    
    /**
     * Write the block height.
     */
    buffer.write_uint32(m_block_height);
    
    /**
     * Write the block hash
     */
    buffer.write_sha256(m_hash_block);
    
    /**
     * Write the nonce hash.
     */
    buffer.write_sha256(m_hash_nonce);
    
    /**
     * Write the address length.
     */
    buffer.write_var_int(m_address.size());
    
    /**
     * Write the address.
     */
    buffer.write_bytes(m_address.data(), m_address.size());

    /**
     * Encode the public key.
     */
    m_public_key.encode(buffer);

    /**
     * If we are encoding a copy reuse the existing signature.
     */
    if (is_copy == true)
    {
        /**
         * Write the signature length.
         */
        buffer.write_var_int(m_signature.size());
        
        /**
         * Write the signature.
         */
        buffer.write_bytes(
            reinterpret_cast<char *>(&m_signature[0]),
            m_signature.size()
        );
    }
    else
    {
        /**
         * Sign the message.
         */
        sign(buffer);
    }
}
开发者ID:machado-rev,项目名称:vcash,代码行数:63,代码来源:incentive_vote.cpp

示例13: encode

void transaction_wallet::encode(data_buffer & buffer)
{
    auto is_spent = false;

    m_values["fromaccount"] = m_from_account;

    std::string str;
    
    for (auto & i : m_spent)
    {
        str += (i ? '1' : '0');
        
        if (i)
        {
            is_spent = true;
        }
    }
    
    m_values["spent"] = str;

    wallet::write_order_position(m_order_position, m_values);

    if (m_time_smart)
    {
        m_values["timesmart"] = std::to_string(m_time_smart);
    }
    
    /**
     * Encode the base class.
     */
    transaction_merkle::encode(buffer);
    
    buffer.write_var_int(m_previous_transactions.size());
    
    for (auto & i : m_previous_transactions)
    {
        i.encode(buffer);
    }
    
    /**
     * If we are an (SPV) client set the block height as a value.
     */
    if (globals::instance().is_client_spv() == true)
    {
        auto block_height = spv_block_height();
        
        m_values["spv_block_height"] = std::to_string(block_height);
    }
    
    buffer.write_var_int(m_values.size());
    
    for (auto & i : m_values)
    {
        buffer.write_var_int(i.first.size());
        buffer.write_bytes(i.first.data(), i.first.size());
        buffer.write_var_int(i.second.size());
        buffer.write_bytes(i.second.data(), i.second.size());
    }
    
    buffer.write_var_int(m_order_form.size());
    
    for (auto & i : m_order_form)
    {
        buffer.write_var_int(i.first.size());
        buffer.write_bytes(i.first.data(), i.first.size());
        buffer.write_var_int(i.second.size());
        buffer.write_bytes(i.second.data(), i.second.size());
    }
    
    buffer.write_uint32(m_time_received_is_tx_time);
    buffer.write_uint32(m_time_received);
    buffer.write_uint8(m_is_from_me);
    buffer.write_uint8(is_spent);

    m_values.erase("fromaccount");
    m_values.erase("version");
    m_values.erase("spent");
    m_values.erase("n");
    m_values.erase("timesmart");
}
开发者ID:xCoreDev,项目名称:vcash,代码行数:80,代码来源:transaction_wallet.cpp


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