Exemplo n.º 1
0
void checkpoint_sync_unsigned::encode(data_buffer & buffer)
{
    buffer.write_int32(m_version);
    buffer.write_sha256(m_hash_checkpoint);
}
Exemplo n.º 2
0
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);
     }
}