Bitcoin ABC
0.31.1
P2P Digital Currency
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
f
g
h
i
k
m
n
o
p
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
h
i
l
m
n
p
q
r
s
t
u
v
w
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
!
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
!
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
m
n
o
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
f
g
i
o
p
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
b
c
d
e
h
i
k
l
m
n
p
r
s
t
u
v
Enumerations
b
c
d
e
f
g
h
i
j
m
n
o
p
r
s
t
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
u
v
w
x
y
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
rpc
server_util.cpp
Go to the documentation of this file.
1
// Copyright (c) 2021 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <
rpc/server_util.h
>
6
7
#include <
avalanche/processor.h
>
8
#include <
common/args.h
>
9
#include <
net_processing.h
>
10
#include <
node/context.h
>
11
#include <
rpc/protocol.h
>
12
#include <
rpc/request.h
>
13
#include <
txmempool.h
>
14
#include <
util/any.h
>
15
#include <validation.h>
16
17
#include <any>
18
19
using
node::NodeContext
;
20
21
NodeContext
&
EnsureAnyNodeContext
(
const
std::any &context) {
22
auto
node_context = util::AnyPtr<NodeContext>(context);
23
if
(!node_context) {
24
throw
JSONRPCError
(
RPC_INTERNAL_ERROR
,
"Node context not found"
);
25
}
26
return
*node_context;
27
}
28
29
CTxMemPool
&
EnsureMemPool
(
const
NodeContext
&
node
) {
30
if
(!
node
.mempool) {
31
throw
JSONRPCError
(
RPC_CLIENT_MEMPOOL_DISABLED
,
32
"Mempool disabled or instance not found"
);
33
}
34
return
*
node
.mempool;
35
}
36
37
CTxMemPool
&
EnsureAnyMemPool
(
const
std::any &context) {
38
return
EnsureMemPool
(
EnsureAnyNodeContext
(context));
39
}
40
41
ArgsManager
&
EnsureArgsman
(
const
NodeContext
&
node
) {
42
if
(!
node
.args) {
43
throw
JSONRPCError
(
RPC_INTERNAL_ERROR
,
"Node args not found"
);
44
}
45
return
*
node
.args;
46
}
47
48
ArgsManager
&
EnsureAnyArgsman
(
const
std::any &context) {
49
return
EnsureArgsman
(
EnsureAnyNodeContext
(context));
50
}
51
52
ChainstateManager
&
EnsureChainman
(
const
NodeContext
&
node
) {
53
if
(!
node
.chainman) {
54
throw
JSONRPCError
(
RPC_INTERNAL_ERROR
,
"Node chainman not found"
);
55
}
56
return
*
node
.chainman;
57
}
58
59
ChainstateManager
&
EnsureAnyChainman
(
const
std::any &context) {
60
return
EnsureChainman
(
EnsureAnyNodeContext
(context));
61
}
62
63
CConnman
&
EnsureConnman
(
const
NodeContext
&
node
) {
64
if
(!
node
.connman) {
65
throw
JSONRPCError
(
66
RPC_CLIENT_P2P_DISABLED
,
67
"Error: Peer-to-peer functionality missing or disabled"
);
68
}
69
return
*
node
.connman;
70
}
71
72
PeerManager
&
EnsurePeerman
(
const
NodeContext
&
node
) {
73
if
(!
node
.peerman) {
74
throw
JSONRPCError
(
75
RPC_CLIENT_P2P_DISABLED
,
76
"Error: Peer-to-peer functionality missing or disabled"
);
77
}
78
return
*
node
.peerman;
79
}
80
81
avalanche::Processor
&
EnsureAvalanche
(
const
NodeContext
&
node
) {
82
if
(!
node
.avalanche) {
83
throw
JSONRPCError
(
RPC_INTERNAL_ERROR
,
84
"Error: Avalanche processor missing or disabled"
);
85
}
86
return
*
node
.avalanche;
87
}
any.h
args.h
ArgsManager
Definition:
args.h:96
CConnman
Definition:
net.h:856
CTxMemPool
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition:
txmempool.h:214
ChainstateManager
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition:
validation.h:1149
PeerManager
Definition:
net_processing.h:69
avalanche::Processor
Definition:
processor.h:159
node
Definition:
init.h:31
net_processing.h
context.h
processor.h
JSONRPCError
UniValue JSONRPCError(int code, const std::string &message)
Definition:
request.cpp:58
request.h
protocol.h
RPC_CLIENT_MEMPOOL_DISABLED
@ RPC_CLIENT_MEMPOOL_DISABLED
Chain errors.
Definition:
protocol.h:86
RPC_INTERNAL_ERROR
@ RPC_INTERNAL_ERROR
Definition:
protocol.h:33
RPC_CLIENT_P2P_DISABLED
@ RPC_CLIENT_P2P_DISABLED
No valid connection manager instance found.
Definition:
protocol.h:81
EnsureAnyChainman
ChainstateManager & EnsureAnyChainman(const std::any &context)
Definition:
server_util.cpp:59
EnsureAnyNodeContext
NodeContext & EnsureAnyNodeContext(const std::any &context)
Definition:
server_util.cpp:21
EnsureMemPool
CTxMemPool & EnsureMemPool(const NodeContext &node)
Definition:
server_util.cpp:29
EnsurePeerman
PeerManager & EnsurePeerman(const NodeContext &node)
Definition:
server_util.cpp:72
EnsureChainman
ChainstateManager & EnsureChainman(const NodeContext &node)
Definition:
server_util.cpp:52
EnsureAnyMemPool
CTxMemPool & EnsureAnyMemPool(const std::any &context)
Definition:
server_util.cpp:37
EnsureArgsman
ArgsManager & EnsureArgsman(const NodeContext &node)
Definition:
server_util.cpp:41
EnsureAvalanche
avalanche::Processor & EnsureAvalanche(const NodeContext &node)
Definition:
server_util.cpp:81
EnsureConnman
CConnman & EnsureConnman(const NodeContext &node)
Definition:
server_util.cpp:63
EnsureAnyArgsman
ArgsManager & EnsureAnyArgsman(const std::any &context)
Definition:
server_util.cpp:48
server_util.h
node::NodeContext
NodeContext struct containing references to chain state and connection state.
Definition:
context.h:46
txmempool.h
Generated on Thu Apr 10 2025 22:04:34 for Bitcoin ABC by
1.9.4