Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
node
warnings.h
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-present 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
#ifndef BITCOIN_NODE_WARNINGS_H
7
#define BITCOIN_NODE_WARNINGS_H
8
9
#include <
sync.h
>
10
#include <
util/translation.h
>
11
12
#include <map>
13
#include <variant>
14
#include <vector>
15
16
class
UniValue
;
17
18
namespace
kernel
{
19
enum class
Warning
;
20
}
// namespace kernel
21
22
namespace
node
{
23
enum class
Warning
{
24
CLOCK_OUT_OF_SYNC
,
25
PRE_RELEASE_TEST_BUILD
,
26
FATAL_INTERNAL_ERROR
,
27
};
28
39
class
Warnings
40
{
41
typedef
std::variant<kernel::Warning, node::Warning>
warning_type
;
42
43
mutable
Mutex
m_mutex
;
44
std::map<warning_type, bilingual_str> m_warnings
GUARDED_BY
(
m_mutex
);
45
46
public
:
47
Warnings
();
49
Warnings
(
const
Warnings
&) =
delete
;
50
Warnings
&
operator=
(
const
Warnings
&) =
delete
;
63
bool
Set
(
warning_type
id
,
bilingual_str
message)
EXCLUSIVE_LOCKS_REQUIRED
(!
m_mutex
);
75
bool
Unset
(
warning_type
id
)
EXCLUSIVE_LOCKS_REQUIRED
(!
m_mutex
);
78
std::vector<bilingual_str>
GetMessages
() const
EXCLUSIVE_LOCKS_REQUIRED
(!
m_mutex
);
79
};
80
87
UniValue
GetWarningsForRpc
(const
Warnings
& warnings,
bool
use_deprecated);
88
}
// namespace node
89
90
#endif
// BITCOIN_NODE_WARNINGS_H
UniValue
Definition
univalue.h:22
node::Warnings::GUARDED_BY
std::map< warning_type, bilingual_str > m_warnings GUARDED_BY(m_mutex)
node::Warnings::warning_type
std::variant< kernel::Warning, node::Warning > warning_type
Definition
warnings.h:41
node::Warnings::Warnings
Warnings(const Warnings &)=delete
A warnings instance should always be passed by reference, never copied.
node::Warnings::Unset
bool Unset(warning_type id) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Unset a warning message.
Definition
warnings.cpp:36
node::Warnings::Warnings
Warnings()
Definition
warnings.cpp:20
node::Warnings::m_mutex
Mutex m_mutex
Definition
warnings.h:43
node::Warnings::operator=
Warnings & operator=(const Warnings &)=delete
node::Warnings::Set
bool Set(warning_type id, bilingual_str message) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Set a warning message.
Definition
warnings.cpp:29
node::Warnings::GetMessages
std::vector< bilingual_str > GetMessages() const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Return potential problems detected by the node, sorted by the warning_type id.
Definition
warnings.cpp:43
kernel
Definition
coinstatsindex.h:21
kernel::Warning
Warning
Definition
warning.h:9
node
Definition
messages.h:21
node::GetWarningsForRpc
UniValue GetWarningsForRpc(const Warnings &warnings, bool use_deprecated)
RPC helper function that wraps warnings.GetMessages().
Definition
warnings.cpp:54
node::Warning
Warning
Definition
warnings.h:23
node::Warning::CLOCK_OUT_OF_SYNC
@ CLOCK_OUT_OF_SYNC
Definition
warnings.h:24
node::Warning::FATAL_INTERNAL_ERROR
@ FATAL_INTERNAL_ERROR
Definition
warnings.h:26
node::Warning::PRE_RELEASE_TEST_BUILD
@ PRE_RELEASE_TEST_BUILD
Definition
warnings.h:25
bilingual_str
Bilingual messages:
Definition
translation.h:24
sync.h
Mutex
AnnotatedMixin< std::mutex > Mutex
Wrapped mutex: supports waiting but not recursive locking.
Definition
sync.h:123
EXCLUSIVE_LOCKS_REQUIRED
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition
threadsafety.h:51
translation.h
Generated on
for Bitcoin Core by
1.17.0