mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge b1a672d158 into merged_master (Bitcoin PR bitcoin/bitcoin#22337)
This commit is contained in:
commit
a20c67310c
17 changed files with 92 additions and 80 deletions
|
|
@ -20,10 +20,10 @@
|
|||
//! 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;
|
||||
|
||||
bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, std::string& error)
|
||||
bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, bilingual_str& error)
|
||||
{
|
||||
if (LEGACY_OUTPUT_TYPES.count(type) == 0) {
|
||||
error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types").translated;
|
||||
error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types");
|
||||
return false;
|
||||
}
|
||||
assert(type != OutputType::BECH32M);
|
||||
|
|
@ -34,7 +34,7 @@ bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestinat
|
|||
// Generate a new key that is added to wallet
|
||||
CPubKey new_key;
|
||||
if (!GetKeyFromPool(new_key, type)) {
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first").translated;
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return false;
|
||||
}
|
||||
LearnRelatedScripts(new_key, type);
|
||||
|
|
@ -302,22 +302,22 @@ bool LegacyScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, WalletBat
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, std::string& error)
|
||||
bool LegacyScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, bilingual_str& error)
|
||||
{
|
||||
if (LEGACY_OUTPUT_TYPES.count(type) == 0) {
|
||||
error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types").translated;
|
||||
error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types");
|
||||
return false;
|
||||
}
|
||||
assert(type != OutputType::BECH32M);
|
||||
|
||||
LOCK(cs_KeyStore);
|
||||
if (!CanGetAddresses(internal)) {
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first").translated;
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ReserveKeyFromKeyPool(index, keypool, internal)) {
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first").translated;
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return false;
|
||||
}
|
||||
address = GetDestinationForKey(keypool.vchPubKey, type);
|
||||
|
|
@ -599,7 +599,7 @@ bool LegacyScriptPubKeyMan::CanProvide(const CScript& script, SignatureData& sig
|
|||
}
|
||||
}
|
||||
|
||||
bool LegacyScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, std::string>& input_errors) const
|
||||
bool LegacyScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const
|
||||
{
|
||||
return ::SignTransaction(tx, this, coins, sighash, Params().HashGenesisBlock(), input_errors);
|
||||
}
|
||||
|
|
@ -1619,11 +1619,11 @@ std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
|
|||
return set_address;
|
||||
}
|
||||
|
||||
bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, std::string& error)
|
||||
bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, bilingual_str& error)
|
||||
{
|
||||
// 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()) {
|
||||
error = "No addresses available";
|
||||
error = _("No addresses available");
|
||||
return false;
|
||||
}
|
||||
{
|
||||
|
|
@ -1642,12 +1642,12 @@ bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDest
|
|||
std::vector<CScript> scripts_temp;
|
||||
if (m_wallet_descriptor.range_end <= m_max_cached_index && !TopUp(1)) {
|
||||
// We can't generate anymore keys
|
||||
error = "Error: Keypool ran out, please call keypoolrefill first";
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return false;
|
||||
}
|
||||
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
|
||||
error = "Error: Keypool ran out, please call keypoolrefill first";
|
||||
error = _("Error: Keypool ran out, please call keypoolrefill first");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1727,7 +1727,7 @@ bool DescriptorScriptPubKeyMan::Encrypt(const CKeyingMaterial& master_key, Walle
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, std::string& error)
|
||||
bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, bilingual_str& error)
|
||||
{
|
||||
LOCK(cs_desc_man);
|
||||
bool result = GetNewDestination(type, address, error);
|
||||
|
|
@ -2052,7 +2052,7 @@ bool DescriptorScriptPubKeyMan::CanProvide(const CScript& script, SignatureData&
|
|||
return IsMine(script);
|
||||
}
|
||||
|
||||
bool DescriptorScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, std::string>& input_errors) const
|
||||
bool DescriptorScriptPubKeyMan::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const
|
||||
{
|
||||
std::unique_ptr<FlatSigningProvider> keys = std::make_unique<FlatSigningProvider>();
|
||||
for (const auto& coin_pair : coins) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue