<commit_before>#pragma once
#include <bts/chain/types.hpp>
#include <bts/chain/transaction.hpp>

namespace bts { namespace chain {

   struct block_header
   {
      digest_type                   digest()const;
      block_id_type                 previous;
      uint32_t                      block_num()const { return num_from_id(previous) + 1; }
      fc::time_point_sec            timestamp;
      witness_id_type               witness;
      secret_hash_type              next_secret_hash;
      secret_hash_type              previous_secret;
      checksum_type                 transaction_merkle_root;

      static uint32_t num_from_id(const block_id_type& id) { return htonl(id._hash[0]); }
   };

   struct signed_block_header : public block_header
   {
      block_id_type              id()const;
      fc::ecc::public_key        signee()const;
      void                       sign( const fc::ecc::private_key& signer );
      bool                       validate_signee( const fc::ecc::public_key& expected_signee )const;

      signature_type             delegate_signature;
   };

   struct signed_block : public signed_block_header
   {
      checksum_type calculate_merkle_root()const;
      vector<processed_transaction> transactions;
   };

} } // bts::chain

FC_REFLECT( bts::chain::block_header, (previous)(timestamp)(witness)
            (next_secret_hash)(previous_secret)(transaction_merkle_root) )
FC_REFLECT_DERIVED( bts::chain::signed_block_header, (bts::chain::block_header), (delegate_signature) )
FC_REFLECT_DERIVED( bts::chain::signed_block, (bts::chain::signed_block_header), (transactions) )<commit_msg>adding a hook to extend the header without breaking serialization<commit_after>#pragma once
#include <bts/chain/types.hpp>
#include <bts/chain/transaction.hpp>

namespace bts { namespace chain {

   struct void_header{};
   typedef fc::static_variant<void_header> header_extension;

   struct block_header
   {
      digest_type                   digest()const;
      block_id_type                 previous;
      uint32_t                      block_num()const { return num_from_id(previous) + 1; }
      fc::time_point_sec            timestamp;
      witness_id_type               witness;
      secret_hash_type              next_secret_hash;
      secret_hash_type              previous_secret;
      checksum_type                 transaction_merkle_root;
      vector<header_extension>      extensions;

      static uint32_t num_from_id(const block_id_type& id) { return htonl(id._hash[0]); }
   };

   struct signed_block_header : public block_header
   {
      block_id_type              id()const;
      fc::ecc::public_key        signee()const;
      void                       sign( const fc::ecc::private_key& signer );
      bool                       validate_signee( const fc::ecc::public_key& expected_signee )const;

      signature_type             delegate_signature;
   };

   struct signed_block : public signed_block_header
   {
      checksum_type calculate_merkle_root()const;
      vector<processed_transaction> transactions;
   };

} } // bts::chain

FC_REFLECT( bts::chain::void_header, )
FC_REFLECT( bts::chain::block_header, (previous)(timestamp)(witness)
            (next_secret_hash)(previous_secret)(transaction_merkle_root)(extensions) )
FC_REFLECT_DERIVED( bts::chain::signed_block_header, (bts::chain::block_header), (delegate_signature) )
FC_REFLECT_DERIVED( bts::chain::signed_block, (bts::chain::signed_block_header), (transactions) )
{'fraction_non_alphanumeric': 0.09070165430690245, 'fraction_numerical': 0.0034227039361095267, 'mean_word_length': 2.730851063829787, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7048483', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1020, 'n_words': 178}