Bitcoin Core  22.99.0
P2P Digital Currency
ismine.h
Go to the documentation of this file.
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 
41 enum isminetype : unsigned int {
42  ISMINE_NO = 0,
44  ISMINE_SPENDABLE = 1 << 1,
45  ISMINE_USED = 1 << 2,
49 };
51 using isminefilter = std::underlying_type<isminetype>::type;
52 
57 {
58  // NO and ALL are never (supposed to be) cached
59  std::bitset<ISMINE_ENUM_ELEMENTS> m_cached;
61  inline void Reset()
62  {
63  m_cached.reset();
64  }
65  void Set(isminefilter filter, CAmount value)
66  {
67  m_cached.set(filter);
68  m_value[filter] = value;
69  }
70 };
71 } // namespace wallet
72 
73 #endif // BITCOIN_WALLET_ISMINE_H
wallet::ISMINE_USED
@ ISMINE_USED
Definition: ismine.h:45
wallet::isminetype
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: ismine.h:41
wallet::ISMINE_WATCH_ONLY
@ ISMINE_WATCH_ONLY
Definition: ismine.h:43
wallet::isminefilter
std::underlying_type< isminetype >::type isminefilter
used for bitflags of isminetype
Definition: wallet.h:40
wallet::CachableAmount::Set
void Set(isminefilter filter, CAmount value)
Definition: ismine.h:65
wallet
Definition: node.h:38
wallet::ISMINE_ALL_USED
@ ISMINE_ALL_USED
Definition: ismine.h:47
CAmount
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
standard.h
wallet::CachableAmount::m_cached
std::bitset< ISMINE_ENUM_ELEMENTS > m_cached
Definition: ismine.h:59
wallet::ISMINE_ENUM_ELEMENTS
@ ISMINE_ENUM_ELEMENTS
Definition: ismine.h:48
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
wallet::CachableAmount::m_value
CAmount m_value[ISMINE_ENUM_ELEMENTS]
Definition: ismine.h:60
wallet::ISMINE_ALL
@ ISMINE_ALL
Definition: ismine.h:46
wallet::ISMINE_SPENDABLE
@ ISMINE_SPENDABLE
Definition: ismine.h:44
wallet::CachableAmount::Reset
void Reset()
Definition: ismine.h:61
wallet::CachableAmount
Cachable amount subdivided into watchonly and spendable parts.
Definition: ismine.h:56
wallet::ISMINE_NO
@ ISMINE_NO
Definition: ismine.h:42