dash/src/net_types.h
Konstantin Akimov 051cdb3cae
refactor: new helpers in net_processing for external handlers
That's a prior work for removing circular dependencies over net_processing
2024-01-10 15:12:05 -06:00

36 lines
776 B
C++

// 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 <util/expected.h>
#include <map>
#include <string>
class CBanEntry;
class CSubNet;
using banmap_t = std::map<CSubNet, CBanEntry>;
struct MisbehavingError
{
int score;
std::string message;
MisbehavingError(int s) : score{s} {}
// Constructor does a perfect forwarding reference
template <typename T>
MisbehavingError(int s, T&& msg) :
score{s},
message{std::forward<T>(msg)}
{}
};
using PeerMsgRet = tl::expected<void, MisbehavingError>;
#endif // BITCOIN_NET_TYPES_H