mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-11 09:42:17 +01:00
Disallow bech32m addresses for legacy wallet things
We don't want the legacy wallet to ever have bech32m addresses so don't allow importing them. This includes addmultisigaddress as that is a legacy wallet only RPC Additionally, bech32m multisigs are not available yet, so disallow them in createmultisig.
This commit is contained in:
@@ -108,3 +108,19 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore,
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
assert(false);
|
||||
}
|
||||
|
||||
std::optional<OutputType> OutputTypeFromDestination(const CTxDestination& dest) {
|
||||
if (std::holds_alternative<PKHash>(dest) ||
|
||||
std::holds_alternative<ScriptHash>(dest)) {
|
||||
return OutputType::LEGACY;
|
||||
}
|
||||
if (std::holds_alternative<WitnessV0KeyHash>(dest) ||
|
||||
std::holds_alternative<WitnessV0ScriptHash>(dest)) {
|
||||
return OutputType::BECH32;
|
||||
}
|
||||
if (std::holds_alternative<WitnessV1Taproot>(dest) ||
|
||||
std::holds_alternative<WitnessUnknown>(dest)) {
|
||||
return OutputType::BECH32M;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user