mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
remove unused GetDestinationForKey
It is only used in test. There it is problematic, because it sometimes
relies on m_default_address_type. If the default were changed to
BECH32M, those tests would fail the assert(false).
So just use PKHash{} in all tests and remove GetDestinationForKey.
This commit is contained in:
@@ -46,27 +46,6 @@ const std::string& FormatOutputType(OutputType type)
|
||||
assert(false);
|
||||
}
|
||||
|
||||
CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)
|
||||
{
|
||||
switch (type) {
|
||||
case OutputType::LEGACY: return PKHash(key);
|
||||
case OutputType::P2SH_SEGWIT:
|
||||
case OutputType::BECH32: {
|
||||
if (!key.IsCompressed()) return PKHash(key);
|
||||
CTxDestination witdest = WitnessV0KeyHash(key);
|
||||
CScript witprog = GetScriptForDestination(witdest);
|
||||
if (type == OutputType::P2SH_SEGWIT) {
|
||||
return ScriptHash(witprog);
|
||||
} else {
|
||||
return witdest;
|
||||
}
|
||||
}
|
||||
case OutputType::BECH32M:
|
||||
case OutputType::UNKNOWN: {} // This function should never be used with BECH32M or UNKNOWN, so let it assert
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
assert(false);
|
||||
}
|
||||
|
||||
CTxDestination AddAndGetDestinationForScript(FlatSigningProvider& keystore, const CScript& script, OutputType type)
|
||||
{
|
||||
// Add script to keystore
|
||||
|
||||
Reference in New Issue
Block a user