mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge 006740b6f6 into merged_master (Bitcoin PR bitcoin/bitcoin#25721)
This commit is contained in:
commit
49d368ea6b
25 changed files with 282 additions and 160 deletions
|
|
@ -21,10 +21,10 @@ namespace wallet {
|
|||
//! Value for the first BIP 32 hardened derivation. Can be used as a bit mask and as a value. See BIP 32 for more details.
|
||||
const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000;
|
||||
|
||||
BResult<CTxDestination> LegacyScriptPubKeyMan::GetNewDestination(const OutputType type)
|
||||
util::Result<CTxDestination> LegacyScriptPubKeyMan::GetNewDestination(const OutputType type)
|
||||
{
|
||||
if (LEGACY_OUTPUT_TYPES.count(type) == 0) {
|
||||
return _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types");;
|
||||
return util::Error{_("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types")};
|
||||
}
|
||||
assert(type != OutputType::BECH32M);
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ BResult<CTxDestination> LegacyScriptPubKeyMan::GetNewDestination(const OutputTyp
|
|||
// Generate a new key that is added to wallet
|
||||
CPubKey new_key;
|
||||
if (!GetKeyFromPool(new_key, type)) {
|
||||
return _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")};
|
||||
}
|
||||
LearnRelatedScripts(new_key, type);
|
||||
return GetDestinationForKey(new_key, type);
|
||||
|
|
@ -1659,11 +1659,11 @@ std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
|
|||
return set_address;
|
||||
}
|
||||
|
||||
BResult<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type)
|
||||
util::Result<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type)
|
||||
{
|
||||
// Returns true if this descriptor supports getting new addresses. Conditions where we may be unable to fetch them (e.g. locked) are caught later
|
||||
if (!CanGetAddresses()) {
|
||||
return _("No addresses available");
|
||||
return util::Error{_("No addresses available")};
|
||||
}
|
||||
{
|
||||
LOCK(cs_desc_man);
|
||||
|
|
@ -1681,11 +1681,11 @@ BResult<CTxDestination> DescriptorScriptPubKeyMan::GetNewDestination(const Outpu
|
|||
std::vector<CScript> scripts_temp;
|
||||
if (m_wallet_descriptor.range_end <= m_max_cached_index && !TopUp(1)) {
|
||||
// We can't generate anymore keys
|
||||
return _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")};
|
||||
}
|
||||
if (!m_wallet_descriptor.descriptor->ExpandFromCache(m_wallet_descriptor.next_index, m_wallet_descriptor.cache, scripts_temp, out_keys)) {
|
||||
// We can't generate anymore keys
|
||||
return _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")};
|
||||
}
|
||||
|
||||
CTxDestination dest;
|
||||
|
|
@ -1771,11 +1771,11 @@ bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bo
|
|||
auto op_dest = GetNewDestination(type);
|
||||
index = m_wallet_descriptor.next_index - 1;
|
||||
if (op_dest) {
|
||||
address = op_dest.GetObj();
|
||||
address = *op_dest;
|
||||
} else {
|
||||
error = op_dest.GetError();
|
||||
error = util::ErrorString(op_dest);
|
||||
}
|
||||
return op_dest.HasRes();
|
||||
return bool(op_dest);
|
||||
}
|
||||
|
||||
void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, const CTxDestination& addr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue