1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 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 
13 class CKeyStore;
14 class CScript;
15 
16 /** IsMine() return codes */
17 enum isminetype
18 {
19     ISMINE_NO = 0,
20     //! Indicates that we don't know how to create a scriptSig that would solve this if we were given the appropriate private keys
21     ISMINE_WATCH_UNSOLVABLE = 1,
22     //! Indicates that we know how to create a scriptSig that would solve this if we were given the appropriate private keys
23     ISMINE_WATCH_SOLVABLE = 2,
24     ISMINE_WATCH_ONLY = ISMINE_WATCH_SOLVABLE | ISMINE_WATCH_UNSOLVABLE,
25     ISMINE_SPENDABLE = 4,
26     ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE
27 };
28 /** used for bitflags of isminetype */
29 typedef uint8_t isminefilter;
30 
31 /* isInvalid becomes true when the script is found invalid by consensus or policy. This will terminate the recursion
32  * and return a ISMINE_NO immediately, as an invalid script should never be considered as "mine". This is needed as
33  * different SIGVERSION may have different network rules. Currently the only use of isInvalid is indicate uncompressed
34  * keys in SIGVERSION_WITNESS_V0 script, but could also be used in similar cases in the future
35  */
36 isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey, bool& isInvalid, SigVersion = SIGVERSION_BASE);
37 isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey, SigVersion = SIGVERSION_BASE);
38 isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest, bool& isInvalid, SigVersion = SIGVERSION_BASE);
39 isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest, SigVersion = SIGVERSION_BASE);
40 
41 #endif // BITCOIN_SCRIPT_ISMINE_H
42