diff options
Diffstat (limited to 'src/script/ismine.cpp')
-rw-r--r-- | src/script/ismine.cpp | 22 |
1 files changed, 12 insertions, 10 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; } |