Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/ismine.h
Show All 22 Lines | enum isminetype : unsigned int { | ||||
ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE, | ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE, | ||||
ISMINE_ALL_USED = ISMINE_ALL | ISMINE_USED, | ISMINE_ALL_USED = ISMINE_ALL | ISMINE_USED, | ||||
ISMINE_ENUM_ELEMENTS, | ISMINE_ENUM_ELEMENTS, | ||||
}; | }; | ||||
/** used for bitflags of isminetype */ | /** used for bitflags of isminetype */ | ||||
typedef uint8_t isminefilter; | typedef uint8_t isminefilter; | ||||
isminetype IsMine(const CWallet &wallet, const CScript &scriptPubKey); | |||||
isminetype IsMine(const CWallet &wallet, const CTxDestination &dest); | |||||
/** | /** | ||||
* Cachable amount subdivided into watchonly and spendable parts. | * Cachable amount subdivided into watchonly and spendable parts. | ||||
*/ | */ | ||||
struct CachableAmount { | struct CachableAmount { | ||||
// NO and ALL are never (supposed to be) cached | // NO and ALL are never (supposed to be) cached | ||||
std::bitset<ISMINE_ENUM_ELEMENTS> m_cached; | std::bitset<ISMINE_ENUM_ELEMENTS> m_cached; | ||||
Amount m_value[ISMINE_ENUM_ELEMENTS]; | Amount m_value[ISMINE_ENUM_ELEMENTS]; | ||||
inline void Reset() { m_cached.reset(); } | inline void Reset() { m_cached.reset(); } | ||||
void Set(isminefilter filter, Amount value) { | void Set(isminefilter filter, Amount value) { | ||||
m_cached.set(filter); | m_cached.set(filter); | ||||
m_value[filter] = value; | m_value[filter] = value; | ||||
} | } | ||||
}; | }; | ||||
#endif // BITCOIN_WALLET_ISMINE_H | #endif // BITCOIN_WALLET_ISMINE_H |