2021-12-30 14:36:57 -03:00
|
|
|
// Copyright (c) 2010-2021 The Bitcoin Core developers
|
2019-04-02 18:03:37 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#include <util/error.h>
|
|
|
|
|
2019-06-17 03:56:52 -04:00
|
|
|
#include <tinyformat.h>
|
2019-04-02 18:03:37 -03:00
|
|
|
#include <util/system.h>
|
2019-06-17 03:56:52 -04:00
|
|
|
#include <util/translation.h>
|
2019-04-02 18:03:37 -03:00
|
|
|
|
2020-06-05 08:26:16 -04:00
|
|
|
bilingual_str TransactionErrorString(const TransactionError err)
|
2019-04-02 18:03:37 -03:00
|
|
|
{
|
|
|
|
switch (err) {
|
|
|
|
case TransactionError::OK:
|
2020-06-05 08:26:16 -04:00
|
|
|
return Untranslated("No error");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::MISSING_INPUTS:
|
2020-01-31 22:03:53 -03:00
|
|
|
return Untranslated("Inputs missing or spent");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::ALREADY_IN_CHAIN:
|
2020-06-05 08:26:16 -04:00
|
|
|
return Untranslated("Transaction already in block chain");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::P2P_DISABLED:
|
2020-06-05 08:26:16 -04:00
|
|
|
return Untranslated("Peer-to-peer functionality missing or disabled");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::MEMPOOL_REJECTED:
|
2021-11-03 09:06:40 -03:00
|
|
|
return Untranslated("Transaction rejected by mempool");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::MEMPOOL_ERROR:
|
2021-11-03 09:06:40 -03:00
|
|
|
return Untranslated("Mempool internal error");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::INVALID_PSBT:
|
2020-01-31 22:03:53 -03:00
|
|
|
return Untranslated("PSBT is not well-formed");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::PSBT_MISMATCH:
|
2020-06-05 08:26:16 -04:00
|
|
|
return Untranslated("PSBTs not compatible (different transactions)");
|
2019-04-02 18:03:37 -03:00
|
|
|
case TransactionError::SIGHASH_MISMATCH:
|
2020-01-31 22:03:53 -03:00
|
|
|
return Untranslated("Specified sighash value does not match value stored in PSBT");
|
2019-06-28 22:44:38 -04:00
|
|
|
case TransactionError::MAX_FEE_EXCEEDED:
|
2020-08-25 10:00:38 -04:00
|
|
|
return Untranslated("Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)");
|
2019-08-04 17:26:01 -04:00
|
|
|
case TransactionError::EXTERNAL_SIGNER_NOT_FOUND:
|
|
|
|
return Untranslated("External signer not found");
|
|
|
|
case TransactionError::EXTERNAL_SIGNER_FAILED:
|
|
|
|
return Untranslated("External signer failed to sign");
|
2019-04-02 18:03:37 -03:00
|
|
|
// no default case, so the compiler can warn about missing cases
|
|
|
|
}
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
2020-06-05 08:26:16 -04:00
|
|
|
bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind)
|
2019-08-15 10:06:23 -04:00
|
|
|
{
|
2020-06-05 08:26:16 -04:00
|
|
|
return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind);
|
2019-08-15 10:06:23 -04:00
|
|
|
}
|
|
|
|
|
2019-08-20 11:00:43 -04:00
|
|
|
bilingual_str AmountHighWarn(const std::string& optname)
|
2019-04-02 18:03:37 -03:00
|
|
|
{
|
2019-08-20 11:00:43 -04:00
|
|
|
return strprintf(_("%s is set very high!"), optname);
|
2019-04-02 18:03:37 -03:00
|
|
|
}
|
|
|
|
|
2019-08-20 11:00:43 -04:00
|
|
|
bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue)
|
2019-04-02 18:03:37 -03:00
|
|
|
{
|
2019-08-20 11:00:43 -04:00
|
|
|
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
|
2019-04-02 18:03:37 -03:00
|
|
|
}
|