2019-04-02 18:03:37 -03:00
|
|
|
// Copyright (c) 2010-2018 The Bitcoin Core developers
|
|
|
|
// 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
|
|
|
|
|
|
|
std::string TransactionErrorString(const TransactionError err)
|
|
|
|
{
|
|
|
|
switch (err) {
|
|
|
|
case TransactionError::OK:
|
|
|
|
return "No error";
|
|
|
|
case TransactionError::MISSING_INPUTS:
|
|
|
|
return "Missing inputs";
|
|
|
|
case TransactionError::ALREADY_IN_CHAIN:
|
|
|
|
return "Transaction already in block chain";
|
|
|
|
case TransactionError::P2P_DISABLED:
|
|
|
|
return "Peer-to-peer functionality missing or disabled";
|
|
|
|
case TransactionError::MEMPOOL_REJECTED:
|
|
|
|
return "Transaction rejected by AcceptToMemoryPool";
|
|
|
|
case TransactionError::MEMPOOL_ERROR:
|
|
|
|
return "AcceptToMemoryPool failed";
|
|
|
|
case TransactionError::INVALID_PSBT:
|
|
|
|
return "PSBT is not sane";
|
|
|
|
case TransactionError::PSBT_MISMATCH:
|
|
|
|
return "PSBTs not compatible (different transactions)";
|
|
|
|
case TransactionError::SIGHASH_MISMATCH:
|
|
|
|
return "Specified sighash value does not match existing value";
|
2019-06-28 22:44:38 -04:00
|
|
|
case TransactionError::MAX_FEE_EXCEEDED:
|
|
|
|
return "Fee exceeds maximum configured by -maxtxfee";
|
2019-04-02 18:03:37 -03:00
|
|
|
// no default case, so the compiler can warn about missing cases
|
|
|
|
}
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
2019-08-15 10:06:23 -04:00
|
|
|
std::string ResolveErrMsg(const std::string& optname, const std::string& strBind)
|
|
|
|
{
|
|
|
|
return strprintf(_("Cannot resolve -%s address: '%s'").translated, optname, strBind);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|