Bitcoin ABC 0.32.4
P2P Digital Currency
processor.h
Go to the documentation of this file.
1// Copyright (c) 2018-2019 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_AVALANCHE_PROCESSOR_H
6#define BITCOIN_AVALANCHE_PROCESSOR_H
7
8#include <avalanche/config.h>
9#include <avalanche/node.h>
10#include <avalanche/proof.h>
12#include <avalanche/protocol.h>
14#include <avalanche/voterecord.h> // For AVALANCHE_MAX_INFLIGHT_POLL
15#include <blockindex.h>
17#include <common/bloom.h>
18#include <eventloop.h>
19#include <interfaces/chain.h>
20#include <interfaces/handler.h>
21#include <key.h>
22#include <net.h>
24#include <rwcollection.h>
25#include <txmempool.h>
26#include <util/variant.h>
27#include <validationinterface.h>
28
29#include <boost/multi_index/composite_key.hpp>
30#include <boost/multi_index/hashed_index.hpp>
31#include <boost/multi_index/member.hpp>
32#include <boost/multi_index/ordered_index.hpp>
33#include <boost/multi_index_container.hpp>
34
35#include <atomic>
36#include <chrono>
37#include <cstdint>
38#include <memory>
39#include <unordered_map>
40#include <variant>
41#include <vector>
42
43class ArgsManager;
44class CConnman;
45class CNode;
46class CScheduler;
47class Config;
48class PeerManager;
49struct bilingual_str;
50
54static constexpr size_t AVALANCHE_MAX_ELEMENT_POLL = 16;
55
60static constexpr size_t AVALANCHE_CONTENDER_MAX_POLLABLE = 12;
61
65static constexpr std::chrono::milliseconds AVALANCHE_DEFAULT_QUERY_TIMEOUT{
66 10000};
67
78
79namespace avalanche {
80
81class Delegation;
82class PeerManager;
83class ProofRegistrationState;
84struct VoteRecord;
85
86enum struct VoteStatus : uint8_t {
87 Invalid,
91 Stale,
92};
93
94using AnyVoteItem = std::variant<const ProofRef, const CBlockIndex *,
96
100
101public:
103 : item(std::move(itemIn)), status(statusIn) {}
104
105 const VoteStatus &getStatus() const { return status; }
106 const AnyVoteItem &getVoteItem() const { return item; }
107};
108
110 bool operator()(const AnyVoteItem &lhs, const AnyVoteItem &rhs) const {
111 // If the variants are of different types, sort them by variant index
112 if (lhs.index() != rhs.index()) {
113 return lhs.index() < rhs.index();
114 }
115
116 return std::visit(
118 [](const ProofRef &lhs, const ProofRef &rhs) {
119 return ProofComparatorByScore()(lhs, rhs);
120 },
121 [](const CBlockIndex *lhs, const CBlockIndex *rhs) {
122 // Reverse ordering so we get the highest work first
123 return CBlockIndexWorkComparator()(rhs, lhs);
124 },
125 [](const StakeContenderId &lhs, const StakeContenderId &rhs) {
126 return lhs < rhs;
127 },
128 [](const CTransactionRef &lhs, const CTransactionRef &rhs) {
129 return lhs->GetId() < rhs->GetId();
130 },
131 [](const auto &lhs, const auto &rhs) {
132 // This serves 2 purposes:
133 // - This makes sure that we don't forget to implement a
134 // comparison case when adding a new variant type.
135 // - This avoids having to write all the cross type cases
136 // which are already handled by the index sort above.
137 // Because the compiler has no way to determine that, we
138 // cannot use static assertions here without having to
139 // define the whole type matrix also.
140 assert(false);
141 // Return any bool, it's only there to make the compiler
142 // happy.
143 return false;
144 },
145 },
146 lhs, rhs);
147 }
148};
149using VoteMap = std::map<AnyVoteItem, VoteRecord, VoteMapComparator>;
150
152
153namespace {
154 struct AvalancheTest;
155}
156
157// FIXME Implement a proper notification handler for node disconnection instead
158// of implementing the whole NetEventsInterface for a single interesting event.
159class Processor final : public NetEventsInterface {
164
169
173 std::atomic<uint64_t> round;
174
179 std::unique_ptr<PeerManager> peerManager GUARDED_BY(cs_peerManager);
180
181 struct Query {
183 uint64_t round;
185
192 mutable std::vector<CInv> invs;
193 };
194
195 using QuerySet = boost::multi_index_container<
196 Query,
197 boost::multi_index::indexed_by<
198 // index by nodeid/round
199 boost::multi_index::hashed_unique<boost::multi_index::composite_key<
200 Query,
201 boost::multi_index::member<Query, NodeId, &Query::nodeid>,
202 boost::multi_index::member<Query, uint64_t, &Query::round>>>,
203 // sorted by timeout
204 boost::multi_index::ordered_non_unique<
205 boost::multi_index::tag<query_timeout>,
206 boost::multi_index::member<Query, SteadyMilliseconds,
207 &Query::timeout>>>>;
208
210
212 struct PeerData;
213 std::unique_ptr<PeerData> peerData;
215
218
224 std::atomic<bool> quorumIsEstablished{false};
225 std::atomic<bool> m_canShareLocalProof{false};
227 std::atomic<int64_t> avaproofsNodeCounter{0};
228
230 const uint32_t staleVoteThreshold;
231 const uint32_t staleVoteFactor;
232
235 std::unique_ptr<interfaces::Handler> chainNotificationsHandler;
236
238 const CBlockIndex *finalizationTip GUARDED_BY(cs_finalizationTip){nullptr};
239
245 std::unordered_set<NodeId>
246 delayedAvahelloNodeIds GUARDED_BY(cs_delayedAvahelloNodeIds);
247
250 // Ordered list of acceptable winners, only the first is used for mining
251 std::vector<std::pair<ProofId, CScript>> winners;
252 };
253
255 std::unordered_map<BlockHash, StakingReward, SaltedUint256Hasher>
257
260 CScheduler &scheduler, std::unique_ptr<PeerData> peerDataIn,
261 CKey sessionKeyIn, uint32_t minQuorumTotalScoreIn,
262 double minQuorumConnectedScoreRatioIn,
263 int64_t minAvaproofsNodeCountIn, uint32_t staleVoteThresholdIn,
264 uint32_t staleVoteFactorIn, Amount stakeUtxoDustThresholdIn,
265 bool preConsensus, bool stakingPreConsensus);
266
267 const bool m_preConsensus{false};
268 // Not const for testing purpose
269 std::atomic_bool m_stakingPreConsensus{false};
270
271public:
272 ~Processor();
273
274 static std::unique_ptr<Processor>
275 MakeProcessor(const ArgsManager &argsman, interfaces::Chain &chain,
277 CTxMemPool *mempoolIn, CScheduler &scheduler,
278 bilingual_str &error);
279
280 bool addToReconcile(const AnyVoteItem &item)
287 bool reconcileOrFinalize(const ProofRef &proof)
289 bool isAccepted(const AnyVoteItem &item) const;
290 int getConfidence(const AnyVoteItem &item) const;
291 bool isPolled(const AnyVoteItem &item) const;
292
293 bool isRecentlyFinalized(const uint256 &itemId) const
295 void setRecentlyFinalized(const uint256 &itemId)
298
299 // TODO: Refactor the API to remove the dependency on avalanche/protocol.h
300 void sendResponse(CNode *pfrom, Response response) const;
301 bool registerVotes(NodeId nodeid, const Response &response,
302 std::vector<VoteItemUpdate> &updates, bool &disconnect,
303 std::string &error)
306
307 template <typename Callable>
308 auto withPeerManager(Callable &&func) const
311 return func(*peerManager);
312 }
313
321 bool sendHello(CNode *pfrom)
325
326 ProofRef getLocalProof() const;
329
330 /*
331 * Return whether the avalanche service flag should be set.
332 */
334
338 return finalizationTip != nullptr;
339 }
340
341 bool startEventLoop(CScheduler &scheduler);
342 bool stopEventLoop();
343
346 int64_t getAvaproofsNodeCounter() const {
347 return avaproofsNodeCounter.load();
348 }
352 bool canShareLocalProof();
353
354 bool computeStakingReward(const CBlockIndex *pindex)
357 bool eraseStakingRewardWinner(const BlockHash &prevBlockHash)
359 void cleanupStakingRewards(const int minHeight)
362 const BlockHash &prevBlockHash,
363 std::vector<std::pair<ProofId, CScript>> &winners) const
365 bool getStakingRewardWinners(const BlockHash &prevBlockHash,
366 std::vector<CScript> &payouts) const
368 bool setStakingRewardWinners(const CBlockIndex *pprev,
369 const std::vector<CScript> &payouts)
372 const CBlockIndex *pprev,
373 const std::vector<std::pair<ProofId, CScript>> &winners)
375
376 // Implement NetEventInterface. Only FinalizeNode is of interest.
377 void InitializeNode(const ::Config &config, CNode &pnode,
378 ServiceFlags our_services) override {}
379 bool ProcessMessages(const ::Config &config, CNode *pnode,
380 std::atomic<bool> &interrupt) override {
381 return false;
382 }
383 bool SendMessages(const ::Config &config, CNode *pnode) override {
384 return false;
385 }
386
388 void FinalizeNode(const ::Config &config,
389 const CNode &node) override LOCKS_EXCLUDED(cs_main)
391
393 int getStakeContenderStatus(const StakeContenderId &contenderId) const
395 void acceptStakeContender(const StakeContenderId &contenderId)
397 void finalizeStakeContender(const StakeContenderId &contenderId)
399 void rejectStakeContender(const StakeContenderId &contenderId)
401
406
407 bool isPreconsensusActivated(const CBlockIndex *pprev) const;
408 bool isStakingPreconsensusActivated(const CBlockIndex *pprev) const;
409
410private:
411 void updatedBlockTip()
416 void runEventLoop()
420 std::vector<CInv> getInvsForNextPoll(bool forPoll = true)
422 bool sendHelloInternal(CNode *pfrom)
424 AnyVoteItem getVoteItemFromInv(const CInv &inv) const
426
433 const CBlockIndex *pindex,
434 std::vector<StakeContenderId> &pollableContenders)
436
445 100, 0.0000001};
446
459
462
463 IsWorthPolling(const Processor &_processor) : processor(_processor){};
464
465 bool operator()(const CBlockIndex *pindex) const
467 bool operator()(const ProofRef &proof) const
469 bool operator()(const StakeContenderId &contenderId) const
471 bool operator()(const CTransactionRef &tx) const;
472 };
473 bool isWorthPolling(const AnyVoteItem &item) const
475
478
479 GetLocalAcceptance(const Processor &_processor)
480 : processor(_processor){};
481
482 bool operator()(const CBlockIndex *pindex) const
484 bool operator()(const ProofRef &proof) const
486 bool operator()(const StakeContenderId &contenderId) const;
487 bool operator()(const CTransactionRef &tx) const;
488 };
489 bool getLocalAcceptance(const AnyVoteItem &item) const {
490 return std::visit(GetLocalAcceptance(*this), item);
491 }
492
493 friend struct ::avalanche::AvalancheTest;
494};
495
496} // namespace avalanche
497
498#endif // BITCOIN_AVALANCHE_PROCESSOR_H
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Definition: net.h:824
Inv(ventory) message data.
Definition: protocol.h:582
An encapsulated secp256k1 private key.
Definition: key.h:28
Information about a peer.
Definition: net.h:395
An encapsulated public key.
Definition: pubkey.h:31
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set.
Definition: bloom.h:115
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:41
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:221
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
Definition: validation.h:1186
Definition: config.h:19
Interface for message handling.
Definition: net.h:773
void sendResponse(CNode *pfrom, Response response) const
Definition: processor.cpp:545
const uint32_t staleVoteThreshold
Voting parameters.
Definition: processor.h:230
std::atomic< bool > quorumIsEstablished
Definition: processor.h:224
boost::multi_index_container< Query, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::composite_key< Query, boost::multi_index::member< Query, NodeId, &Query::nodeid >, boost::multi_index::member< Query, uint64_t, &Query::round > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< query_timeout >, boost::multi_index::member< Query, SteadyMilliseconds, &Query::timeout > > > > QuerySet
Definition: processor.h:207
AnyVoteItem getVoteItemFromInv(const CInv &inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:1380
Mutex cs_finalizedItems
Rolling bloom filter to track recently finalized inventory items of any type.
Definition: processor.h:456
bool sendHelloInternal(CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(cs_delayedAvahelloNodeIds)
Definition: processor.cpp:710
int getConfidence(const AnyVoteItem &item) const
Definition: processor.cpp:479
bool addToReconcile(const AnyVoteItem &item) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:428
std::vector< CInv > getInvsForNextPoll(bool forPoll=true) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:1331
bool isStakingPreconsensusActivated(const CBlockIndex *pprev) const
Definition: processor.cpp:1518
int64_t getAvaproofsNodeCounter() const
Definition: processor.h:346
RWCollection< QuerySet > queries
Definition: processor.h:209
bool hasFinalizedTip() const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizationTip)
Whether there is a finalized tip.
Definition: processor.h:336
bool ProcessMessages(const ::Config &config, CNode *pnode, std::atomic< bool > &interrupt) override
Definition: processor.h:379
ProofRegistrationState getLocalProofRegistrationState() const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:771
bool setContenderStatusForLocalWinners(const CBlockIndex *pindex, std::vector< StakeContenderId > &pollableContenders) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Helper to set the vote status for local winners in the contender cache.
Definition: processor.cpp:1151
void transactionAddedToMempool(const CTransactionRef &tx) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:1217
const CBlockIndex *finalizationTip GUARDED_BY(cs_finalizationTip)
Definition: processor.h:238
bool sendHello(CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
Send a avahello message.
Definition: processor.cpp:745
bool isRecentlyFinalized(const uint256 &itemId) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:503
void setRecentlyFinalized(const uint256 &itemId) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:507
bool startEventLoop(CScheduler &scheduler)
Definition: processor.cpp:802
bool isQuorumEstablished() LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:832
std::atomic< uint64_t > round
Keep track of peers and queries sent.
Definition: processor.h:173
static std::unique_ptr< Processor > MakeProcessor(const ArgsManager &argsman, interfaces::Chain &chain, CConnman *connman, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, bilingual_str &error)
Definition: processor.cpp:224
EventLoop eventLoop
Event loop machinery.
Definition: processor.h:217
CTxMemPool * mempool
Definition: processor.h:163
int64_t minAvaproofsNodeCount
Definition: processor.h:226
const bool m_preConsensus
Definition: processor.h:267
bool isPolled(const AnyVoteItem &item) const
Definition: processor.cpp:493
Mutex cs_delayedAvahelloNodeIds
Definition: processor.h:240
bool setStakingRewardWinners(const CBlockIndex *pprev, const std::vector< CScript > &payouts) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
Definition: processor.cpp:1028
void runEventLoop() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:1224
bool isAvalancheServiceAvailable()
Definition: processor.h:333
Mutex cs_invalidatedBlocks
We don't need many blocks but a low false positive rate.
Definition: processor.h:443
void updatedBlockTip() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:1163
RWCollection< VoteMap > voteRecords
Items to run avalanche on.
Definition: processor.h:168
std::unique_ptr< interfaces::Handler > chainNotificationsHandler
Definition: processor.h:235
uint32_t minQuorumScore
Quorum management.
Definition: processor.h:222
void FinalizeNode(const ::Config &config, const CNode &node) override LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Handle removal of a node.
Definition: processor.cpp:1064
bool getStakingRewardWinners(const BlockHash &prevBlockHash, std::vector< std::pair< ProofId, CScript > > &winners) const EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
Definition: processor.cpp:999
std::atomic< bool > m_canShareLocalProof
Definition: processor.h:225
void cleanupStakingRewards(const int minHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
Definition: processor.cpp:977
bool isAccepted(const AnyVoteItem &item) const
Definition: processor.cpp:465
ProofRef getLocalProof() const
Definition: processor.cpp:767
void acceptStakeContender(const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:1095
void InitializeNode(const ::Config &config, CNode &pnode, ServiceFlags our_services) override
Definition: processor.h:377
bool reconcileOrFinalize(const ProofRef &proof) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Wrapper around the addToReconcile for proofs that adds back the finalization flag to the peer if it i...
Definition: processor.cpp:446
int getStakeContenderStatus(const StakeContenderId &contenderId) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Track votes on stake contenders.
Definition: processor.cpp:1072
const uint32_t staleVoteFactor
Definition: processor.h:231
void promoteAndPollStakeContenders(const CBlockIndex *pprev) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards
Promote stake contender cache entries to a given block and then poll.
Definition: processor.cpp:1127
void sendDelayedAvahello() EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
Definition: processor.cpp:750
void finalizeStakeContender(const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:1100
std::unique_ptr< PeerData > peerData
Definition: processor.h:213
bool eraseStakingRewardWinner(const BlockHash &prevBlockHash) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
Definition: processor.cpp:972
bool isPreconsensusActivated(const CBlockIndex *pprev) const
Definition: processor.cpp:1514
CConnman * connman
Definition: processor.h:161
bool isWorthPolling(const AnyVoteItem &item) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:1473
CPubKey getSessionPubKey() const
Definition: processor.cpp:706
auto withPeerManager(Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.h:308
std::unique_ptr< PeerManager > peerManager GUARDED_BY(cs_peerManager)
Processor(Config avaconfig, interfaces::Chain &chain, CConnman *connmanIn, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, std::unique_ptr< PeerData > peerDataIn, CKey sessionKeyIn, uint32_t minQuorumTotalScoreIn, double minQuorumConnectedScoreRatioIn, int64_t minAvaproofsNodeCountIn, uint32_t staleVoteThresholdIn, uint32_t staleVoteFactorIn, Amount stakeUtxoDustThresholdIn, bool preConsensus, bool stakingPreConsensus)
Definition: processor.cpp:146
ChainstateManager & chainman
Definition: processor.h:162
std::atomic< int64_t > avaproofsNodeCounter
Definition: processor.h:227
bool SendMessages(const ::Config &config, CNode *pnode) override
Definition: processor.h:383
std::atomic_bool m_stakingPreConsensus
Definition: processor.h:269
bool computeStakingReward(const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:932
bool registerVotes(NodeId nodeid, const Response &response, std::vector< VoteItemUpdate > &updates, bool &disconnect, std::string &error) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Definition: processor.cpp:552
CRollingBloomFilter finalizedItems GUARDED_BY(cs_finalizedItems)
Definition: processor.h:457
void clearTimedoutRequests() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:1292
std::unordered_map< BlockHash, StakingReward, SaltedUint256Hasher > stakingRewards GUARDED_BY(cs_stakingRewards)
Mutex cs_peerManager
Keep track of the peers and associated infos.
Definition: processor.h:178
bool getLocalAcceptance(const AnyVoteItem &item) const
Definition: processor.h:489
void rejectStakeContender(const StakeContenderId &contenderId) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:1122
std::unordered_set< NodeId > delayedAvahelloNodeIds GUARDED_BY(cs_delayedAvahelloNodeIds)
A list of the nodes that did not get our proof announced via avahello yet because we had no inbound c...
void avaproofsSent(NodeId nodeid) LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Definition: processor.cpp:811
double minQuorumConnectedScoreRatio
Definition: processor.h:223
void clearFinalizedItems() EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
Definition: processor.cpp:511
const AnyVoteItem & getVoteItem() const
Definition: processor.h:106
VoteItemUpdate(AnyVoteItem itemIn, VoteStatus statusIn)
Definition: processor.h:102
const VoteStatus & getStatus() const
Definition: processor.h:105
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:136
256-bit opaque blob.
Definition: uint256.h:129
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: cs_main.cpp:7
int64_t NodeId
Definition: eviction.h:16
std::variant< const ProofRef, const CBlockIndex *, const StakeContenderId, const CTransactionRef > AnyVoteItem
Definition: processor.h:95
std::map< AnyVoteItem, VoteRecord, VoteMapComparator > VoteMap
Definition: processor.h:149
RCUPtr< const Proof > ProofRef
Definition: proof.h:186
Definition: init.h:31
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition: rcu.h:259
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:315
Response response
Definition: processor.cpp:522
static constexpr size_t AVALANCHE_CONTENDER_MAX_POLLABLE
Maximum number of stake contenders to poll for, leaving room for polling blocks and proofs in the sam...
Definition: processor.h:60
static constexpr std::chrono::milliseconds AVALANCHE_DEFAULT_QUERY_TIMEOUT
How long before we consider that a query timed out.
Definition: processor.h:65
static constexpr size_t AVALANCHE_MAX_ELEMENT_POLL
Maximum item that can be polled at once.
Definition: processor.h:54
static constexpr uint32_t AVALANCHE_FINALIZED_ITEMS_FILTER_NUM_ELEMENTS
The size of the finalized items filter.
Definition: processor.h:76
ServiceFlags
nServices flags.
Definition: protocol.h:336
Definition: amount.h:19
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13
bool operator()(const CBlockIndex *pindex) const LOCKS_EXCLUDED(cs_main)
Definition: processor.cpp:1478
GetLocalAcceptance(const Processor &_processor)
Definition: processor.h:479
IsWorthPolling(const Processor &_processor)
Definition: processor.h:463
bool operator()(const CBlockIndex *pindex) const LOCKS_EXCLUDED(cs_main)
Definition: processor.cpp:1411
SteadyMilliseconds timeout
Definition: processor.h:184
std::vector< CInv > invs
We declare this as mutable so it can be modified in the multi_index.
Definition: processor.h:192
std::vector< std::pair< ProofId, CScript > > winners
Definition: processor.h:251
Compare proofs by score, then by id in case of equality.
StakeContenderIds are unique for each block to ensure that the peer polling for their acceptance has ...
bool operator()(const AnyVoteItem &lhs, const AnyVoteItem &rhs) const
Definition: processor.h:110
Bilingual messages:
Definition: translation.h:17
#define LOCK(cs)
Definition: sync.h:306
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:56
#define LOCKS_EXCLUDED(...)
Definition: threadsafety.h:55
std::chrono::time_point< std::chrono::steady_clock, std::chrono::milliseconds > SteadyMilliseconds
Definition: time.h:31
assert(!tx.IsCoinBase())
static constexpr int AVALANCHE_MAX_INFLIGHT_POLL
How many inflight requests can exist for one item.
Definition: voterecord.h:40