Changeset View
Changeset View
Standalone View
Standalone View
src/outputtype.cpp
Show All 22 Lines | bool ParseOutputType(const std::string &type, OutputType &output_type) { | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
const std::string &FormatOutputType(OutputType type) { | const std::string &FormatOutputType(OutputType type) { | ||||
switch (type) { | switch (type) { | ||||
case OutputType::LEGACY: | case OutputType::LEGACY: | ||||
return OUTPUT_TYPE_STRING_LEGACY; | return OUTPUT_TYPE_STRING_LEGACY; | ||||
default: | } // no default case, so the compiler can warn about missing cases | ||||
assert(false); | assert(false); | ||||
} | } | ||||
} | |||||
CTxDestination GetDestinationForKey(const CPubKey &key, OutputType type) { | CTxDestination GetDestinationForKey(const CPubKey &key, OutputType type) { | ||||
switch (type) { | switch (type) { | ||||
case OutputType::LEGACY: | case OutputType::LEGACY: | ||||
return PKHash(key); | return PKHash(key); | ||||
default: | } // no default case, so the compiler can warn about missing cases | ||||
assert(false); | assert(false); | ||||
} | } | ||||
} | |||||
std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey &key) { | std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey &key) { | ||||
PKHash keyid(key); | PKHash keyid(key); | ||||
CTxDestination p2pkh{keyid}; | CTxDestination p2pkh{keyid}; | ||||
return Vector(std::move(p2pkh)); | return Vector(std::move(p2pkh)); | ||||
} | } | ||||
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, | CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, | ||||
const CScript &script, | const CScript &script, | ||||
OutputType type) { | OutputType type) { | ||||
// Add script to keystore | // Add script to keystore | ||||
keystore.AddCScript(script); | keystore.AddCScript(script); | ||||
// Note that scripts over 520 bytes are not yet supported. | // Note that scripts over 520 bytes are not yet supported. | ||||
switch (type) { | switch (type) { | ||||
case OutputType::LEGACY: | case OutputType::LEGACY: | ||||
return ScriptHash(script); | return ScriptHash(script); | ||||
default: | } // no default case, so the compiler can warn about missing cases | ||||
assert(false); | assert(false); | ||||
} | } | ||||
} |