mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
wallet: remove duplicate descriptor type check in GetNewDestination
This commit is contained in:
parent
76b982a4a5
commit
bfb9b94ebe
1 changed files with 3 additions and 6 deletions
|
@ -1676,7 +1676,7 @@ util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const
|
|||
std::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");
|
||||
throw std::runtime_error(std::string(__func__) + ": Types are inconsistent. Stored type does not match type of newly generated address");
|
||||
}
|
||||
|
||||
TopUp();
|
||||
|
@ -1694,11 +1694,8 @@ util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const
|
|||
}
|
||||
|
||||
CTxDestination dest;
|
||||
std::optional<OutputType> out_script_type = m_wallet_descriptor.descriptor->GetOutputType();
|
||||
if (out_script_type && out_script_type == type) {
|
||||
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");
|
||||
if (!ExtractDestination(scripts_temp[0], dest)) {
|
||||
return util::Error{_("Error: Cannot extract destination from the generated scriptpubkey")}; // shouldn't happen
|
||||
}
|
||||
m_wallet_descriptor.next_index++;
|
||||
WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor);
|
||||
|
|
Loading…
Add table
Reference in a new issue