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

          Line data    Source code
       1             : // Copyright (c) 2026 The Dash Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #include <index/addressindex_util.h>
       6             : 
       7             : #include <hash.h>
       8             : #include <script/script.h>
       9             : 
      10             : #include <vector>
      11             : 
      12           0 : bool AddressBytesFromScript(const CScript& script, AddressType& address_type, uint160& address_bytes)
      13             : {
      14           0 :     if (script.IsPayToScriptHash()) {
      15           0 :         address_type = AddressType::P2SH;
      16           0 :         address_bytes = uint160(std::vector<uint8_t>(script.begin() + 2, script.begin() + 22));
      17           0 :     } else if (script.IsPayToPublicKeyHash()) {
      18           0 :         address_type = AddressType::P2PK_OR_P2PKH;
      19           0 :         address_bytes = uint160(std::vector<uint8_t>(script.begin() + 3, script.begin() + 23));
      20           0 :     } else if (script.IsPayToPublicKey()) {
      21           0 :         address_type = AddressType::P2PK_OR_P2PKH;
      22           0 :         address_bytes = Hash160(std::vector<uint8_t>(script.begin() + 1, script.end() - 1));
      23           0 :     } else {
      24           0 :         address_type = AddressType::UNKNOWN;
      25           0 :         address_bytes.SetNull();
      26           0 :         return false;
      27             :     }
      28           0 :     return true;
      29           0 : }

Generated by: LCOV version 1.16