diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2018-04-16 16:36:17 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-04-19 21:05:14 -0700 |
commit | 08f322865429c307ea620a1e349855f9eee3af7e (patch) | |
tree | 58e013f2397d4e8857f96d934c97abaf08886ddb /src/script/ismine.cpp | |
parent | 3619735b09c0cb1383d437527bfbd4dc023d9f76 (diff) |
Optimization: only test for witness scripts at top level
Inside P2SH scripts we already know that the P2SH script version of witness keys/scripts
are acceptable, so there is no need to test for it again.
Diffstat (limited to 'src/script/ismine.cpp')
-rw-r--r-- | src/script/ismine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/ismine.cpp b/src/script/ismine.cpp index 0ef4a59f13..eb3847d8e2 100644 --- a/src/script/ismine.cpp +++ b/src/script/ismine.cpp @@ -70,7 +70,7 @@ static isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPu break; case TX_WITNESS_V0_KEYHASH: { - if (!keystore.HaveCScript(CScriptID(CScript() << OP_0 << vSolutions[0]))) { + if (sigversion == IsMineSigVersion::TOP && !keystore.HaveCScript(CScriptID(CScript() << OP_0 << vSolutions[0]))) { // We do not support bare witness outputs unless the P2SH version of it would be // acceptable as well. This protects against matching before segwit activates. // This also applies to the P2WSH case. @@ -106,7 +106,7 @@ static isminetype IsMineInner(const CKeyStore& keystore, const CScript& scriptPu } case TX_WITNESS_V0_SCRIPTHASH: { - if (!keystore.HaveCScript(CScriptID(CScript() << OP_0 << vSolutions[0]))) { + if (sigversion == IsMineSigVersion::TOP && !keystore.HaveCScript(CScriptID(CScript() << OP_0 << vSolutions[0]))) { break; } uint160 hash; |