mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-27 20:47:31 +02:00
wallet: remove duplicate descriptor type check in GetNewDestination
This commit is contained in:
@@ -1676,7 +1676,7 @@ util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const
|
|||||||
std::optional<OutputType> desc_addr_type = m_wallet_descriptor.descriptor->GetOutputType();
|
std::optional<OutputType> desc_addr_type = m_wallet_descriptor.descriptor->GetOutputType();
|
||||||
assert(desc_addr_type);
|
assert(desc_addr_type);
|
||||||
if (type != *desc_addr_type) {
|
if (type != *desc_addr_type) {
|
||||||
throw std::runtime_error(std::string(__func__) + ": Types are inconsistent");
|
throw std::runtime_error(std::string(__func__) + ": Types are inconsistent. Stored type does not match type of newly generated address");
|
||||||
}
|
}
|
||||||
|
|
||||||
TopUp();
|
TopUp();
|
||||||
@@ -1694,11 +1694,8 @@ util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTxDestination dest;
|
CTxDestination dest;
|
||||||
std::optional<OutputType> out_script_type = m_wallet_descriptor.descriptor->GetOutputType();
|
if (!ExtractDestination(scripts_temp[0], dest)) {
|
||||||
if (out_script_type && out_script_type == type) {
|
return util::Error{_("Error: Cannot extract destination from the generated scriptpubkey")}; // shouldn't happen
|
||||||
ExtractDestination(scripts_temp[0], dest);
|
|
||||||
} else {
|
|
||||||
throw std::runtime_error(std::string(__func__) + ": Types are inconsistent. Stored type does not match type of newly generated address");
|
|
||||||
}
|
}
|
||||||
m_wallet_descriptor.next_index++;
|
m_wallet_descriptor.next_index++;
|
||||||
WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor);
|
WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor);
|
||||||
|
Reference in New Issue
Block a user