Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | using BlockVoteMap = | ||||
std::map<const CBlockIndex *, VoteRecord, CBlockIndexWorkComparator>; | std::map<const CBlockIndex *, VoteRecord, CBlockIndexWorkComparator>; | ||||
struct query_timeout {}; | struct query_timeout {}; | ||||
namespace { | namespace { | ||||
struct AvalancheTest; | struct AvalancheTest; | ||||
} | } | ||||
struct PeerData { | |||||
std::optional<Proof> proof; | |||||
std::optional<Delegation> delegation; | |||||
CKey sessionKey; | |||||
static bool FromArgs(PeerData &peerData, const ArgsManager &argsman, | |||||
bilingual_str &error); | |||||
}; | |||||
deadalnix: What i the purpose of this? Is this some independent entity that is of general use outside the… | |||||
class Processor { | class Processor { | ||||
CConnman *connman; | CConnman *connman; | ||||
NodePeerManager *nodePeerManager; | NodePeerManager *nodePeerManager; | ||||
std::chrono::milliseconds queryTimeoutDuration; | std::chrono::milliseconds queryTimeoutDuration; | ||||
/** | /** | ||||
* Blocks to run avalanche on. | * Blocks to run avalanche on. | ||||
*/ | */ | ||||
Show All 36 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 { | |||||
std::optional<Proof> proof; | |||||
std::optional<Delegation> delegation; | |||||
CKey sessionKey; | |||||
static PeerData FromArgs(const ArgsManager &argsman); | |||||
}; | |||||
PeerData peerData; | PeerData peerData; | ||||
/** 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; | ||||
/** | /** | ||||
* Flag indicating that the proof must be registered at first new block | * Flag indicating that the proof must be registered at first new block | ||||
* after IBD | * after IBD | ||||
*/ | */ | ||||
bool mustRegisterProof = false; | bool mustRegisterProof = false; | ||||
public: | public: | ||||
Processor(interfaces::Chain &chain, CConnman *connmanIn, | Processor(interfaces::Chain &chain, CConnman *connmanIn, | ||||
NodePeerManager *nodePeerManagerIn); | NodePeerManager *nodePeerManagerIn); | ||||
Processor(interfaces::Chain &chain, CConnman *connmanIn, | Processor(interfaces::Chain &chain, CConnman *connmanIn, | ||||
NodePeerManager *nodePeerManagerIn, const ArgsManager &argsman); | NodePeerManager *nodePeerManagerIn, const PeerData &peerDataIn); | ||||
~Processor(); | ~Processor(); | ||||
void setQueryTimeoutDuration(std::chrono::milliseconds d) { | void setQueryTimeoutDuration(std::chrono::milliseconds d) { | ||||
queryTimeoutDuration = d; | queryTimeoutDuration = d; | ||||
} | } | ||||
bool addBlockToReconcile(const CBlockIndex *pindex); | bool addBlockToReconcile(const CBlockIndex *pindex); | ||||
bool isAccepted(const CBlockIndex *pindex) const; | bool isAccepted(const CBlockIndex *pindex) const; | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |
What i the purpose of this? Is this some independent entity that is of general use outside the Processor?
If yes, then please add it to the description of the diff.
If not, then please, stop. Ask yourself how you came to create some new publicly exposed entity that is of no real purpose and go fix that problem. It seems to me that the only purpose is initialization, which means go fix the initialization of this whole thing instead if patching layers on top of layers of wrong design. Don't you see it? You've now just enabled the mess to spread to the whole codebase instead of staying contained here.
How is that a win?