PIVX Core  5.6.99
P2P Digital Currency
ismine.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Copyright (c) 2017-2020 The PIVX Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef PIVX_SCRIPT_ISMINE_H
8 #define PIVX_SCRIPT_ISMINE_H
9 
10 #include "destination_io.h"
11 #include "key.h"
12 #include "script/standard.h"
13 #include <bitset>
14 
15 class CKeyStore;
16 class CScript;
17 
19 enum isminetype {
20  ISMINE_NO = 0,
22  ISMINE_SPENDABLE = 1 << 1,
24  ISMINE_COLD = 1 << 2,
37 };
39 typedef uint8_t isminefilter;
40 
41 isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
42 isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
44 isminetype IsMine(const CKeyStore& keystore, const CWDestination& dest);
49 {
50  // NO and ALL are never (supposed to be) cached
51  std::bitset<ISMINE_ENUM_ELEMENTS> m_cached;
53  inline void Reset()
54  {
55  m_cached.reset();
56  }
57  void Set(isminefilter filter, CAmount value)
58  {
59  m_cached.set(filter);
60  m_value[filter] = value;
61  }
62 };
63 
64 #endif // PIVX_SCRIPT_ISMINE_H
int64_t CAmount
Amount in PIV (Can be negative)
Definition: amount.h:13
A virtual base class for key stores.
Definition: keystore.h:23
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:381
Sapling functions.
Definition: address.h:30
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
isminetype
IsMine() return codes.
Definition: ismine.h:19
@ ISMINE_SPENDABLE_NO_DELEGATED
Definition: ismine.h:32
@ ISMINE_ALL
Definition: ismine.h:35
@ ISMINE_WATCH_ONLY_ALL
Definition: ismine.h:34
@ ISMINE_SPENDABLE_ALL
Definition: ismine.h:33
@ ISMINE_COLD
Indicates that we have the staking key of a P2CS.
Definition: ismine.h:24
@ ISMINE_SPENDABLE_SHIELDED
Indicates that we have the spending key of a shielded spend/output.
Definition: ismine.h:30
@ ISMINE_WATCH_ONLY_SHIELDED
Indicates that we don't have the spending key of a shielded spend/output.
Definition: ismine.h:28
@ ISMINE_SPENDABLE
Definition: ismine.h:22
@ ISMINE_NO
Definition: ismine.h:20
@ ISMINE_WATCH_ONLY
Definition: ismine.h:21
@ ISMINE_SPENDABLE_TRANSPARENT
Definition: ismine.h:31
@ ISMINE_ENUM_ELEMENTS
Definition: ismine.h:36
@ ISMINE_SPENDABLE_DELEGATED
Indicates that we have the spending key of a P2CS.
Definition: ismine.h:26
uint8_t isminefilter
used for bitflags of isminetype
Definition: ismine.h:39
isminetype IsMine(const CKeyStore &keystore, const CScript &scriptPubKey)
Definition: ismine.cpp:74
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:72
Cacheable amount subdivided into watchonly and spendable parts.
Definition: ismine.h:49
void Set(isminefilter filter, CAmount value)
Definition: ismine.h:57
CAmount m_value[ISMINE_ENUM_ELEMENTS]
Definition: ismine.h:52
std::bitset< ISMINE_ENUM_ELEMENTS > m_cached
Definition: ismine.h:51
void Reset()
Definition: ismine.h:53