diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-02-04 17:27:41 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2020-02-12 11:48:30 -0500 |
commit | a304a3632f0437f4d0f04589a2200e2da91624a7 (patch) | |
tree | 8174dc5ca5461d09b0147187d0952b7e55b54c7f | |
parent | eb7d8a5b07e89133a5fb465ad1b793362e7439f7 (diff) |
Revert "Store p2sh scripts in AddAndGetDestinationForScript"
This reverts commit 4a7e43e8460127a40a7895519587399feff3b682.
-rw-r--r-- | src/outputtype.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/outputtype.cpp b/src/outputtype.cpp index 567eecb5c9..71b5cba01c 100644 --- a/src/outputtype.cpp +++ b/src/outputtype.cpp @@ -82,30 +82,22 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, { // Add script to keystore keystore.AddCScript(script); - ScriptHash sh(script); // Note that scripts over 520 bytes are not yet supported. switch (type) { case OutputType::LEGACY: - keystore.AddCScript(GetScriptForDestination(sh)); - return sh; + return ScriptHash(script); case OutputType::P2SH_SEGWIT: case OutputType::BECH32: { CTxDestination witdest = WitnessV0ScriptHash(script); CScript witprog = GetScriptForDestination(witdest); // Check if the resulting program is solvable (i.e. doesn't use an uncompressed key) - if (!IsSolvable(keystore, witprog)) { - // Since the wsh is invalid, add and return the sh instead. - keystore.AddCScript(GetScriptForDestination(sh)); - return sh; - } + if (!IsSolvable(keystore, witprog)) return ScriptHash(script); // Add the redeemscript, so that P2WSH and P2SH-P2WSH outputs are recognized as ours. keystore.AddCScript(witprog); if (type == OutputType::BECH32) { return witdest; } else { - ScriptHash sh_w = ScriptHash(witprog); - keystore.AddCScript(GetScriptForDestination(sh_w)); - return sh_w; + return ScriptHash(witprog); } } default: assert(false); |