Bitcoin ABC 0.32.12
P2P Digital Currency
messages.cpp
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2022 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include <common/messages.h>
7
8#include <common/system.h>
9#include <common/types.h>
10#include <node/types.h>
11#include <tinyformat.h>
12#include <util/strencodings.h>
13#include <util/string.h>
14#include <util/translation.h>
15
16#include <cassert>
17#include <string>
18
20
21namespace common {
23 switch (err) {
25 return Untranslated("Inputs missing or spent");
27 return Untranslated(
28 "Specified sighash value does not match value stored in PSBT");
30 return Untranslated("Signer does not support PSBT");
31 // no default case, so the compiler can warn about missing cases
32 }
33 assert(false);
34}
35
37 switch (error) {
38 case TransactionError::OK:
39 return Untranslated("No error");
40 case TransactionError::MISSING_INPUTS:
41 return Untranslated("Missing inputs");
42 case TransactionError::ALREADY_IN_CHAIN:
43 return Untranslated("Transaction already in block chain");
44 case TransactionError::MEMPOOL_REJECTED:
45 return Untranslated("Transaction rejected by mempool");
46 case TransactionError::MEMPOOL_ERROR:
47 return Untranslated("Mempool internal error");
48 case TransactionError::MAX_FEE_EXCEEDED:
49 return Untranslated("Fee exceeds maximum configured by user (e.g. "
50 "-maxtxfee, maxfeerate)");
51 case TransactionError::INVALID_PACKAGE:
52 return Untranslated("Transaction rejected due to invalid package");
53 // no default case, so the compiler can warn about missing cases
54 }
55 assert(false);
56}
57
58bilingual_str ResolveErrMsg(const std::string &optname,
59 const std::string &strBind) {
60 return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind);
61}
62
63bilingual_str InvalidPortErrMsg(const std::string &optname,
64 const std::string &invalid_value) {
65 return strprintf(_("Invalid port specified in %s: '%s'"), optname,
66 invalid_value);
67}
68
69bilingual_str AmountHighWarn(const std::string &optname) {
70 return strprintf(_("%s is set very high!"), optname);
71}
72
73bilingual_str AmountErrMsg(const std::string &optname,
74 const std::string &strValue) {
75 return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname,
76 strValue);
77}
78} // namespace common
is a home for simple enum and struct type definitions that can be used internally by functions in the...
Definition: args.cpp:864
PSBTError
Definition: types.h:17
bilingual_str PSBTErrorString(PSBTError err)
Definition: messages.cpp:22
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
Definition: messages.cpp:73
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
Definition: messages.cpp:58
bilingual_str AmountHighWarn(const std::string &optname)
Definition: messages.cpp:69
bilingual_str InvalidPortErrMsg(const std::string &optname, const std::string &invalid_value)
Definition: messages.cpp:63
bilingual_str TransactionErrorString(const TransactionError error)
Definition: messages.cpp:36
TransactionError
Definition: types.h:17
is a home for public enum and struct type definitions that are used by internally by node code,...
Bilingual messages:
Definition: translation.h:17
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1202
bilingual_str _(const char *psz)
Translation function.
Definition: translation.h:68
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:36
assert(!tx.IsCoinBase())