aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-05-01 12:19:47 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-05-03 11:02:01 -0700
commit4e91820531889e309dc4335fe0de8229c6426040 (patch)
tree08b1907d000ec6c5a904936c6abdbd4c9f654ff6 /src/script
parent6d714c3419b368671bd071a8992950c3dc00e613 (diff)
Make IsMine stop distinguishing solvable/unsolvable
Diffstat (limited to 'src/script')
-rw-r--r--src/script/ismine.cpp22
-rw-r--r--src/script/ismine.h8
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 */