diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/script/ismine.cpp | 22 | ||||
-rw-r--r-- | src/script/ismine.h | 8 |
2 files changed, 14 insertions, 16 deletions
diff --git a/src/script/ismine.cpp b/src/script/ismine.cpp index fefa02fdef..043756829b 100644 --- a/src/script/ismine.cpp +++ b/src/script/ismine.cpp @@ -49,9 +49,9 @@ isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPubKey, b std::vector<valtype> vSolutions; txnouttype whichType; if (!Solver(scriptPubKey, whichType, vSolutions)) { - if (keystore.HaveWatchOnly(scriptPubKey)) - return ISMINE_WATCH_UNSOLVABLE; - return ISMINE_NO; + if (keystore.HaveWatchOnly(scriptPubKey)) { + return ISMINE_WATCH_ONLY; + } } CKeyID keyID; @@ -79,8 +79,9 @@ isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPubKey, b break; } isminetype ret = IsMineInner(keystore, GetScriptForDestination(CKeyID(uint160(vSolutions[0]))), isInvalid, IsMineSigVersion::WITNESS_V0); - if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_SOLVABLE || (ret == ISMINE_NO && isInvalid)) + if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_ONLY || (ret == ISMINE_NO && isInvalid)) { return ret; + } break; } case TX_PUBKEYHASH: @@ -101,8 +102,9 @@ isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPubKey, b CScript subscript; if (keystore.GetCScript(scriptID, subscript)) { isminetype ret = IsMineInner(keystore, subscript, isInvalid, IsMineSigVersion::P2SH); - if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_SOLVABLE || (ret == ISMINE_NO && isInvalid)) + if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_ONLY || (ret == ISMINE_NO && isInvalid)) { return ret; + } } break; } @@ -117,8 +119,9 @@ isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPubKey, b CScript subscript; if (keystore.GetCScript(scriptID, subscript)) { isminetype ret = IsMineInner(keystore, subscript, isInvalid, IsMineSigVersion::WITNESS_V0); - if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_SOLVABLE || (ret == ISMINE_NO && isInvalid)) + if (ret == ISMINE_SPENDABLE || ret == ISMINE_WATCH_ONLY || (ret == ISMINE_NO && isInvalid)) { return ret; + } } break; } @@ -142,16 +145,15 @@ isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPubKey, b } } } - if (HaveKeys(keys, keystore)) + if (HaveKeys(keys, keystore)) { return ISMINE_SPENDABLE; + } break; } } if (keystore.HaveWatchOnly(scriptPubKey)) { - // TODO: This could be optimized some by doing some work after the above solver - SignatureData sigs; - return ProduceSignature(keystore, DUMMY_SIGNATURE_CREATOR, scriptPubKey, sigs) ? ISMINE_WATCH_SOLVABLE : ISMINE_WATCH_UNSOLVABLE; + return ISMINE_WATCH_ONLY; } return ISMINE_NO; } diff --git a/src/script/ismine.h b/src/script/ismine.h index 8573bdfbd2..a15768aecb 100644 --- a/src/script/ismine.h +++ b/src/script/ismine.h @@ -17,12 +17,8 @@ class CScript; enum isminetype { ISMINE_NO = 0, - //! Indicates that we don't know how to create a scriptSig that would solve this if we were given the appropriate private keys - ISMINE_WATCH_UNSOLVABLE = 1, - //! Indicates that we know how to create a scriptSig that would solve this if we were given the appropriate private keys - ISMINE_WATCH_SOLVABLE = 2, - ISMINE_WATCH_ONLY = ISMINE_WATCH_SOLVABLE | ISMINE_WATCH_UNSOLVABLE, - ISMINE_SPENDABLE = 4, + ISMINE_WATCH_ONLY = 1, + ISMINE_SPENDABLE = 2, ISMINE_ALL = ISMINE_WATCH_ONLY | ISMINE_SPENDABLE }; /** used for bitflags of isminetype */ |