Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show All 19 Lines | |||||
#include <boost/multi_index/member.hpp> | #include <boost/multi_index/member.hpp> | ||||
#include <boost/multi_index/ordered_index.hpp> | #include <boost/multi_index/ordered_index.hpp> | ||||
#include <boost/multi_index_container.hpp> | #include <boost/multi_index_container.hpp> | ||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
#include <optional> | |||||
#include <vector> | #include <vector> | ||||
class Config; | class Config; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CScheduler; | class CScheduler; | ||||
class PeerManager; | class PeerManager; | ||||
using NodePeerManager = PeerManager; | using NodePeerManager = PeerManager; | ||||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | using QuerySet = boost::multi_index_container< | ||||
boost::multi_index::ordered_non_unique< | boost::multi_index::ordered_non_unique< | ||||
boost::multi_index::tag<query_timeout>, | boost::multi_index::tag<query_timeout>, | ||||
boost::multi_index::member<Query, TimePoint, | boost::multi_index::member<Query, TimePoint, | ||||
&Query::timeout>>>>; | &Query::timeout>>>>; | ||||
RWCollection<QuerySet> queries; | RWCollection<QuerySet> queries; | ||||
/** Data required to participate. */ | /** Data required to participate. */ | ||||
struct PeerData; | struct PeerData { | ||||
std::unique_ptr<PeerData> peerData; | std::optional<Proof> proof; | ||||
std::optional<Delegation> delegation; | |||||
deadalnix: In what world can we have a delegation but no proof?
I don't think this reflect the set of… | |||||
}; | |||||
PeerData peerData; | |||||
CKey sessionKey; | CKey sessionKey; | ||||
/** Event loop machinery. */ | /** Event loop machinery. */ | ||||
EventLoop eventLoop; | EventLoop eventLoop; | ||||
/** Registered interfaces::Chain::Notifications handler. */ | /** Registered interfaces::Chain::Notifications handler. */ | ||||
class NotificationsHandler; | class NotificationsHandler; | ||||
std::unique_ptr<interfaces::Handler> chainNotificationsHandler; | std::unique_ptr<interfaces::Handler> chainNotificationsHandler; | ||||
Show All 33 Lines | public: | ||||
* Build and return the challenge whose signature we expect a peer to | * Build and return the challenge whose signature we expect a peer to | ||||
* include in his AVAHELLO message. | * include in his AVAHELLO message. | ||||
*/ | */ | ||||
uint256 buildRemoteSighash(CNode *pfrom) const; | uint256 buildRemoteSighash(CNode *pfrom) const; | ||||
/** | /** | ||||
* Get the local proof used by this node. | * Get the local proof used by this node. | ||||
* | * | ||||
* @returns Proof for this node. | * @returns Optional containing the proof for this node if there is one. | ||||
* @throws a std::runtime_error if there is no proof set for this node | |||||
*/ | */ | ||||
const Proof getProof() const; | const std::optional<Proof> &getLocalProof() const; | ||||
std::vector<avalanche::Peer> getPeers() const; | std::vector<avalanche::Peer> getPeers() const; | ||||
std::vector<NodeId> getNodeIdsForPeer(PeerId peerId) const; | std::vector<NodeId> getNodeIdsForPeer(PeerId peerId) const; | ||||
bool startEventLoop(CScheduler &scheduler); | bool startEventLoop(CScheduler &scheduler); | ||||
bool stopEventLoop(); | bool stopEventLoop(); | ||||
private: | private: | ||||
Show All 22 Lines |
In what world can we have a delegation but no proof?
I don't think this reflect the set of constraints we want here. Th optional smart pointer was best.