Merge df303ceb65 into merged_master (Bitcoin PR #18787)

This commit is contained in:
Andrew Poelstra 2020-11-26 01:08:49 +00:00
commit 5dcf991eba
5 changed files with 137 additions and 18 deletions

View file

@ -1584,7 +1584,7 @@ std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
return set_address;
}
void LegacyScriptPubKeyMan::SetType(OutputType type, bool internal) {}
void LegacyScriptPubKeyMan::SetInternal(bool internal) {}
bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, std::string& error)
{
@ -1596,7 +1596,9 @@ bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDest
{
LOCK(cs_desc_man);
assert(m_wallet_descriptor.descriptor->IsSingleType()); // This is a combo descriptor which should not be an active descriptor
if (type != m_address_type) {
Optional<OutputType> desc_addr_type = m_wallet_descriptor.descriptor->GetOutputType();
assert(desc_addr_type);
if (type != *desc_addr_type) {
throw std::runtime_error(std::string(__func__) + ": Types are inconsistent");
}
@ -1864,7 +1866,7 @@ bool DescriptorScriptPubKeyMan::AddDescriptorKeyWithDB(WalletBatch& batch, const
}
}
bool DescriptorScriptPubKeyMan::SetupDescriptorGeneration(const CExtKey& master_key)
bool DescriptorScriptPubKeyMan::SetupDescriptorGeneration(const CExtKey& master_key, OutputType addr_type)
{
LOCK(cs_desc_man);
assert(m_storage.IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
@ -1881,7 +1883,7 @@ bool DescriptorScriptPubKeyMan::SetupDescriptorGeneration(const CExtKey& master_
// Build descriptor string
std::string desc_prefix;
std::string desc_suffix = "/*)";
switch (m_address_type) {
switch (addr_type) {
case OutputType::LEGACY: {
desc_prefix = "pkh(" + xpub + "/44'";
break;
@ -2163,9 +2165,8 @@ uint256 DescriptorScriptPubKeyMan::GetID() const
return id;
}
void DescriptorScriptPubKeyMan::SetType(OutputType type, bool internal)
void DescriptorScriptPubKeyMan::SetInternal(bool internal)
{
this->m_address_type = type;
this->m_internal = internal;
}