From f44abe4bed25a40145ab168adc1589f5df4146f3 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 29 Oct 2019 10:49:48 +0200 Subject: [PATCH] refactor: Remove addrdb.h dependency from node.h --- src/Makefile.am | 1 + src/addrdb.h | 3 +-- src/banman.h | 1 + src/interfaces/node.h | 2 +- src/net_types.h | 15 +++++++++++++++ src/qt/bantablemodel.cpp | 4 ++-- src/rpc/net.cpp | 3 ++- 7 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/net_types.h diff --git a/src/Makefile.am b/src/Makefile.am index 82cc19d57c..bfcc1df784 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -152,6 +152,7 @@ BITCOIN_CORE_H = \ net.h \ net_permissions.h \ net_processing.h \ + net_types.h \ netaddress.h \ netbase.h \ netmessagemaker.h \ diff --git a/src/addrdb.h b/src/addrdb.h index 290b63dd12..ad85224d1f 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -7,6 +7,7 @@ #define BITCOIN_ADDRDB_H #include +#include // For banmap_t #include #include @@ -79,8 +80,6 @@ public: } }; -typedef std::map banmap_t; - /** Access to the (IP) address database (peers.dat) */ class CAddrDB { diff --git a/src/banman.h b/src/banman.h index a1a00309dd..a01190e694 100644 --- a/src/banman.h +++ b/src/banman.h @@ -10,6 +10,7 @@ #include #include +#include // For banmap_t #include // NOTE: When adjusting this, update rpcnet:setban's help ("24h") diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 4ee467014c..06f9e348e3 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -5,9 +5,9 @@ #ifndef BITCOIN_INTERFACES_NODE_H #define BITCOIN_INTERFACES_NODE_H -#include // For banmap_t #include // For CAmount #include // For CConnman::NumConnections +#include // For banmap_t #include // For Network #include // For SecureString diff --git a/src/net_types.h b/src/net_types.h new file mode 100644 index 0000000000..d55a8cde6c --- /dev/null +++ b/src/net_types.h @@ -0,0 +1,15 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_NET_TYPES_H +#define BITCOIN_NET_TYPES_H + +#include + +class CBanEntry; +class CSubNet; + +using banmap_t = std::map; + +#endif // BITCOIN_NET_TYPES_H diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp index ae11b80347..48201b420e 100644 --- a/src/qt/bantablemodel.cpp +++ b/src/qt/bantablemodel.cpp @@ -4,9 +4,9 @@ #include -#include - #include +#include // For banmap_t +#include #include diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 7b1507e4dc..797b6d0996 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -8,8 +8,9 @@ #include #include #include -#include #include +#include +#include // For banmap_t #include #include #include