LCOV - code coverage report
Current view: top level - src/wallet - ismine.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 7 7 100.0 %
Date: 2022-04-21 14:51:19 Functions: 2 2 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2009-2010 Satoshi Nakamoto
#       2                 :            : // Copyright (c) 2009-2021 The Bitcoin Core developers
#       3                 :            : // Distributed under the MIT software license, see the accompanying
#       4                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#       5                 :            : 
#       6                 :            : #ifndef BITCOIN_WALLET_ISMINE_H
#       7                 :            : #define BITCOIN_WALLET_ISMINE_H
#       8                 :            : 
#       9                 :            : #include <script/standard.h>
#      10                 :            : 
#      11                 :            : #include <bitset>
#      12                 :            : #include <cstdint>
#      13                 :            : #include <type_traits>
#      14                 :            : 
#      15                 :            : class CScript;
#      16                 :            : 
#      17                 :            : namespace wallet {
#      18                 :            : class CWallet;
#      19                 :            : 
#      20                 :            : /**
#      21                 :            :  * IsMine() return codes, which depend on ScriptPubKeyMan implementation.
#      22                 :            :  * Not every ScriptPubKeyMan covers all types, please refer to
#      23                 :            :  * https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.21.0.md#ismine-semantics
#      24                 :            :  * for better understanding.
#      25                 :            :  *
#      26                 :            :  * For LegacyScriptPubKeyMan,
#      27                 :            :  * ISMINE_NO: the scriptPubKey is not in the wallet;
#      28                 :            :  * ISMINE_WATCH_ONLY: the scriptPubKey has been imported into the wallet;
#      29                 :            :  * ISMINE_SPENDABLE: the scriptPubKey corresponds to an address owned by the wallet user (can spend with the private key);
#      30                 :            :  * ISMINE_USED: the scriptPubKey corresponds to a used address owned by the wallet user;
#      31                 :            :  * ISMINE_ALL: all ISMINE flags except for USED;
#      32                 :            :  * ISMINE_ALL_USED: all ISMINE flags including USED;
#      33                 :            :  * ISMINE_ENUM_ELEMENTS: the number of isminetype enum elements.
#      34                 :            :  *
#      35                 :            :  * For DescriptorScriptPubKeyMan and future ScriptPubKeyMan,
#      36                 :            :  * ISMINE_NO: the scriptPubKey is not in the wallet;
#      37                 :            :  * ISMINE_SPENDABLE: the scriptPubKey matches a scriptPubKey in the wallet.
#      38                 :            :  * ISMINE_USED: the scriptPubKey corresponds to a used address owned by the wallet user.
#      39                 :            :  *
#      40                 :            :  */
#      41                 :            : enum isminetype : unsigned int {
#      42                 :            :     ISMINE_NO         = 0,
#      43                 :            :     ISMINE_WATCH_ONLY = 1 << 0,
#      44                 :            :     ISMINE_SPENDABLE  = 1 << 1,
#      45                 :            :     ISMINE_USED       = 1 << 2,
#      46                 :            :     ISMINE_ALL        = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE,
#      47                 :            :     ISMINE_ALL_USED   = ISMINE_ALL | ISMINE_USED,
#      48                 :            :     ISMINE_ENUM_ELEMENTS,
#      49                 :            : };
#      50                 :            : /** used for bitflags of isminetype */
#      51                 :            : using isminefilter = std::underlying_type<isminetype>::type;
#      52                 :            : 
#      53                 :            : /**
#      54                 :            :  * Cachable amount subdivided into watchonly and spendable parts.
#      55                 :            :  */
#      56                 :            : struct CachableAmount
#      57                 :            : {
#      58                 :            :     // NO and ALL are never (supposed to be) cached
#      59                 :            :     std::bitset<ISMINE_ENUM_ELEMENTS> m_cached;
#      60                 :            :     CAmount m_value[ISMINE_ENUM_ELEMENTS];
#      61                 :            :     inline void Reset()
#      62                 :     504276 :     {
#      63                 :     504276 :         m_cached.reset();
#      64                 :     504276 :     }
#      65                 :            :     void Set(isminefilter filter, CAmount value)
#      66                 :     110762 :     {
#      67                 :     110762 :         m_cached.set(filter);
#      68                 :     110762 :         m_value[filter] = value;
#      69                 :     110762 :     }
#      70                 :            : };
#      71                 :            : } // namespace wallet
#      72                 :            : 
#      73                 :            : #endif // BITCOIN_WALLET_ISMINE_H

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a