LCOV - code coverage report
Current view: top level - src/index - timestampindex_types.h (source / functions) Hit Total Coverage
Test: test_dash_coverage.info Lines: 0 22 0.0 %
Date: 2026-06-25 07:23:51 Functions: 0 9 0.0 %

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2015 The Bitcoin Core developers
       3             : // Copyright (c) 2016 BitPay Inc.
       4             : // Copyright (c) 2023-2026 The Dash Core developers
       5             : // Distributed under the MIT software license, see the accompanying
       6             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       7             : 
       8             : #ifndef BITCOIN_INDEX_TIMESTAMPINDEX_TYPES_H
       9             : #define BITCOIN_INDEX_TIMESTAMPINDEX_TYPES_H
      10             : 
      11             : #include <serialize.h>
      12             : #include <uint256.h>
      13             : 
      14             : struct CTimestampIndexIteratorKey {
      15             :     uint32_t m_time{0};
      16             : 
      17             :     CTimestampIndexIteratorKey() = default;
      18           0 :     explicit CTimestampIndexIteratorKey(uint32_t time) :
      19           0 :         m_time{time}
      20           0 :     {
      21           0 :     }
      22             : 
      23             :     void SetNull() { m_time = 0; }
      24             : 
      25             :     static size_t GetSerializeSize(int nType, int nVersion) { return 4; }
      26             : 
      27             :     template <typename Stream>
      28           0 :     void Serialize(Stream& s) const
      29             :     {
      30           0 :         ser_writedata32be(s, m_time);
      31           0 :     }
      32             : 
      33             :     template <typename Stream>
      34             :     void Unserialize(Stream& s)
      35             :     {
      36             :         m_time = ser_readdata32be(s);
      37             :     }
      38             : };
      39             : 
      40             : struct CTimestampIndexKey {
      41           0 :     uint32_t m_block_time{0};
      42             :     uint256 m_block_hash;
      43             : 
      44           0 :     CTimestampIndexKey() = default;
      45           0 :     CTimestampIndexKey(uint32_t block_time, uint256 block_hash) :
      46           0 :         m_block_time{block_time},
      47           0 :         m_block_hash{block_hash}
      48           0 :     {
      49           0 :     }
      50             : 
      51             :     void SetNull()
      52             :     {
      53             :         m_block_time = 0;
      54             :         m_block_hash.SetNull();
      55             :     }
      56             : 
      57             :     static size_t GetSerializeSize(int nType, int nVersion) { return 36; }
      58             : 
      59             :     template <typename Stream>
      60           0 :     void Serialize(Stream& s) const
      61             :     {
      62           0 :         ser_writedata32be(s, m_block_time);
      63           0 :         m_block_hash.Serialize(s);
      64           0 :     }
      65             : 
      66             :     template <typename Stream>
      67           0 :     void Unserialize(Stream& s)
      68             :     {
      69           0 :         m_block_time = ser_readdata32be(s);
      70           0 :         m_block_hash.Unserialize(s);
      71           0 :     }
      72             : };
      73             : 
      74             : #endif // BITCOIN_INDEX_TIMESTAMPINDEX_TYPES_H

Generated by: LCOV version 1.16