Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/node.h
// Copyright (c) 2018-2019 The Bitcoin developers | // Copyright (c) 2018-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_NODE_H | #ifndef BITCOIN_AVALANCHE_NODE_H | ||||
#define BITCOIN_AVALANCHE_NODE_H | #define BITCOIN_AVALANCHE_NODE_H | ||||
#include <net.h> // For NodeId | #include <net.h> // For NodeId | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <chrono> | #include <chrono> | ||||
#include <cstdint> | |||||
using PeerId = uint32_t; | |||||
static constexpr PeerId NO_PEER = -1; | |||||
using TimePoint = std::chrono::time_point<std::chrono::steady_clock>; | using TimePoint = std::chrono::time_point<std::chrono::steady_clock>; | ||||
struct AvalancheNode { | struct AvalancheNode { | ||||
NodeId nodeid; | NodeId nodeid; | ||||
int64_t score; | PeerId peerid; | ||||
TimePoint nextRequestTime; | TimePoint nextRequestTime; | ||||
CPubKey pubkey; | CPubKey pubkey; | ||||
AvalancheNode(NodeId nodeid_, PeerId peerid_, CPubKey pubkey_) | |||||
: nodeid(nodeid_), peerid(peerid_), | |||||
nextRequestTime(std::chrono::steady_clock::now()), | |||||
pubkey(std::move(pubkey_)) {} | |||||
}; | }; | ||||
#endif // BITCOIN_AVALANCHE_NODE_H | #endif // BITCOIN_AVALANCHE_NODE_H |