Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
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());
    }
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
void transaction_out::encode(data_buffer & buffer) const
{
    /**
     * Write the value.
     */
    buffer.write_int64(m_value);
    
    /**
     * Write the m_script_public_key size var_int.
     */
    buffer.write_var_int(m_script_public_key.size());
    
    if (m_script_public_key.size() > 0)
    {
        /**
         * Write the m_script_public_key.
         */
        buffer.write_bytes(
            reinterpret_cast<const char *> (&m_script_public_key[0]),
            m_script_public_key.size()
        );
    }
}