Bitcoin Core  0.18.99
P2P Digital Currency
ismine.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2018 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_SCRIPT_ISMINE_H
7 #define BITCOIN_SCRIPT_ISMINE_H
8 
9 #include <script/standard.h>
10 
11 #include <stdint.h>
12 #include <bitset>
13 
14 class CKeyStore;
15 class CScript;
16 
19 {
20  ISMINE_NO = 0,
22  ISMINE_SPENDABLE = 1 << 1,
25 };
27 typedef uint8_t isminefilter;
28 
29 isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
30 isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
31 
36 {
37  // NO and ALL are never (supposed to be) cached
38  std::bitset<ISMINE_ENUM_ELEMENTS> m_cached;
40  inline void Reset()
41  {
42  m_cached.reset();
43  }
44  void Set(isminefilter filter, CAmount value)
45  {
46  m_cached.set(filter);
47  m_value[filter] = value;
48  }
49 };
50 
51 #endif // BITCOIN_SCRIPT_ISMINE_H
CAmount m_value[ISMINE_ENUM_ELEMENTS]
Definition: ismine.h:39
uint8_t isminefilter
used for bitflags of isminetype
Definition: ismine.h:27
std::bitset< ISMINE_ENUM_ELEMENTS > m_cached
Definition: ismine.h:38
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
isminetype
IsMine() return codes.
Definition: ismine.h:18
void Set(isminefilter filter, CAmount value)
Definition: ismine.h:44
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey)
Definition: ismine.cpp:175
Cachable amount subdivided into watchonly and spendable parts.
Definition: ismine.h:35
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:390
void Reset()
Definition: ismine.h:40
A virtual base class for key stores.
Definition: keystore.h:19
boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:139