Changeset View
Changeset View
Standalone View
Standalone View
src/util/error.cpp
// Copyright (c) 2010-2018 The Bitcoin Core developers | // Copyright (c) 2010-2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <util/error.h> | #include <util/error.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
const char *TransactionErrorString(const TransactionError err) { | std::string TransactionErrorString(const TransactionError error) { | ||||
switch (err) { | switch (error) { | ||||
case TransactionError::OK: | case TransactionError::OK: | ||||
return "No error"; | return "No error"; | ||||
case TransactionError::MISSING_INPUTS: | case TransactionError::MISSING_INPUTS: | ||||
return "Missing inputs"; | return "Missing inputs"; | ||||
case TransactionError::ALREADY_IN_CHAIN: | case TransactionError::ALREADY_IN_CHAIN: | ||||
return "Transaction already in block chain"; | return "Transaction already in block chain"; | ||||
case TransactionError::P2P_DISABLED: | case TransactionError::P2P_DISABLED: | ||||
return "Peer-to-peer functionality missing or disabled"; | return "Peer-to-peer functionality missing or disabled"; | ||||
case TransactionError::MEMPOOL_REJECTED: | case TransactionError::MEMPOOL_REJECTED: | ||||
return "Transaction rejected by AcceptToMemoryPool"; | return "Transaction rejected by AcceptToMemoryPool"; | ||||
case TransactionError::MEMPOOL_ERROR: | case TransactionError::MEMPOOL_ERROR: | ||||
return "AcceptToMemoryPool failed"; | return "AcceptToMemoryPool failed"; | ||||
case TransactionError::INVALID_PSBT: | case TransactionError::INVALID_PSBT: | ||||
return "PSBT is not sane"; | return "PSBT is not sane"; | ||||
case TransactionError::PSBT_MISMATCH: | case TransactionError::PSBT_MISMATCH: | ||||
return "PSBTs not compatible (different transactions)"; | return "PSBTs not compatible (different transactions)"; | ||||
case TransactionError::SIGHASH_MISMATCH: | case TransactionError::SIGHASH_MISMATCH: | ||||
return "Specified sighash value does not match existing value"; | return "Specified sighash value does not match existing value"; | ||||
} // no default case, so the compiler can warn about missing cases | |||||
default: | assert(false); | ||||
break; | |||||
} | |||||
return "Unknown error"; | |||||
} | } | ||||
std::string AmountHighWarn(const std::string &optname) { | std::string AmountHighWarn(const std::string &optname) { | ||||
return strprintf(_("%s is set very high!"), optname); | return strprintf(_("%s is set very high!"), optname); | ||||
} | } | ||||
std::string AmountErrMsg(const char *const optname, | std::string AmountErrMsg(const std::string &optname, | ||||
const std::string &strValue) { | const std::string &strValue) { | ||||
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, | return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, | ||||
strValue); | strValue); | ||||
} | } |