Skip to content

Commit bffeb91

Browse files
committed
trivial: realign AddAndGetDestinationForScript() signature with upstream
This does little for us now but realignment opens up the ability to use different output types in future versions by retaining the skeleton.
1 parent 8473831 commit bffeb91

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/outputtype.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)
5151
return Vector(std::move(p2pkh));
5252
}
5353

54-
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script)
54+
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType type)
5555
{
5656
// Add script to keystore
5757
keystore.AddCScript(script);
58+
ScriptHash sh(script);
5859
// Note that scripts over 520 bytes are not yet supported.
59-
return ScriptHash(script);
60+
switch (type) {
61+
case OutputType::LEGACY:
62+
keystore.AddCScript(GetScriptForDestination(sh));
63+
return sh;
64+
default: assert(false);
65+
}
6066
}

src/outputtype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
3737
* This function will automatically add the script (and any other
3838
* necessary scripts) to the keystore.
3939
*/
40-
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script);
40+
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
4141

4242
#endif // BITCOIN_OUTPUTTYPE_H

src/rpc/util.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ CTxDestination AddAndGetMultisigDestination(const int required, const std::vecto
291291
throw JSONRPCError(RPC_INVALID_PARAMETER, (strprintf("redeemScript exceeds size limit: %d > %d", script_out.size(), MAX_SCRIPT_ELEMENT_SIZE)));
292292
}
293293

294-
// Make the address (simpler implementation in compare to bitcoin)
295-
return AddAndGetDestinationForScript(keystore, script_out);
294+
return AddAndGetDestinationForScript(keystore, script_out, OutputType::LEGACY);
296295
}
297296

298297
class DescribeAddressVisitor

0 commit comments

Comments
 (0)