mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge bitcoin/bitcoin#22337: wallet: Use bilingual_str for errors
92993aa5cfChange SignTransaction's input_errors to use bilingual_str (Andrew Chow)171366e89bUse bilingual_str for address fetching functions (Andrew Chow)9571c69b51Add bilingual_str::clear() (Andrew Chow) Pull request description: In a couple of places in the wallet, errors are `std::string`. In order for these errors to be translated, change them to use `bilingual_str`. ACKs for top commit: hebasto: re-ACK92993aa5cf, only rebased since my [previous](https://github.com/bitcoin/bitcoin/pull/22337#pullrequestreview-694542729) review, verified with klementtan: Code review ACK92993aa5cfmeshcollider: Code review ACK92993aa5cfTree-SHA512: 5400e419dd87db8c49b67ed0964de2d44b58010a566ca246f2f0760ed9ef6a9b6f6df7a6adcb211b315b74c727bfe8c7d07eb5690b5922fa5828ceef4c83461f
This commit is contained in:
@@ -1829,11 +1829,11 @@ bool CWallet::SignTransaction(CMutableTransaction& tx) const
|
||||
const CWalletTx& wtx = mi->second;
|
||||
coins[input.prevout] = Coin(wtx.tx->vout[input.prevout.n], wtx.m_confirm.block_height, wtx.IsCoinBase());
|
||||
}
|
||||
std::map<int, std::string> input_errors;
|
||||
std::map<int, bilingual_str> input_errors;
|
||||
return SignTransaction(tx, coins, SIGHASH_DEFAULT, input_errors);
|
||||
}
|
||||
|
||||
bool CWallet::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, std::string>& input_errors) const
|
||||
bool CWallet::SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const
|
||||
{
|
||||
// Try to sign with all ScriptPubKeyMans
|
||||
for (ScriptPubKeyMan* spk_man : GetAllScriptPubKeyMans()) {
|
||||
@@ -2135,7 +2135,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CWallet::GetNewDestination(const OutputType type, const std::string label, CTxDestination& dest, std::string& error)
|
||||
bool CWallet::GetNewDestination(const OutputType type, const std::string label, CTxDestination& dest, bilingual_str& error)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
error.clear();
|
||||
@@ -2145,7 +2145,7 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
|
||||
spk_man->TopUp();
|
||||
result = spk_man->GetNewDestination(type, dest, error);
|
||||
} else {
|
||||
error = strprintf(_("Error: No %s addresses available."), FormatOutputType(type)).translated;
|
||||
error = strprintf(_("Error: No %s addresses available."), FormatOutputType(type));
|
||||
}
|
||||
if (result) {
|
||||
SetAddressBook(dest, label, "receive");
|
||||
@@ -2154,7 +2154,7 @@ bool CWallet::GetNewDestination(const OutputType type, const std::string label,
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, std::string& error)
|
||||
bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& dest, bilingual_str& error)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
error.clear();
|
||||
@@ -2207,11 +2207,11 @@ std::set<CTxDestination> CWallet::GetLabelAddresses(const std::string& label) co
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool internal, std::string& error)
|
||||
bool ReserveDestination::GetReservedDestination(CTxDestination& dest, bool internal, bilingual_str& error)
|
||||
{
|
||||
m_spk_man = pwallet->GetScriptPubKeyMan(type, internal);
|
||||
if (!m_spk_man) {
|
||||
error = strprintf(_("Error: No %s addresses available."), FormatOutputType(type)).translated;
|
||||
error = strprintf(_("Error: No %s addresses available."), FormatOutputType(type));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user