48 uint256 hash = pindex->GetBlockHash();
63 if (!proof.
verify(stakeUtxoDustThreshold, proof_state)) {
66 error =
_(
"The avalanche proof has no stake.");
69 error =
_(
"The avalanche proof stake is too low.");
72 error =
_(
"The avalanche proof has duplicated stake.");
75 error =
_(
"The avalanche proof has invalid stake signatures.");
79 _(
"The avalanche proof has too many utxos (max: %u)."),
83 error =
_(
"The avalanche proof is invalid.");
97 if (!dg.
verify(dg_state, auth)) {
100 error =
_(
"The avalanche delegation has invalid signatures.");
104 "The avalanche delegation has too many delegation levels.");
107 error =
_(
"The avalanche delegation is invalid.");
112 if (auth != expectedPubKey) {
114 "The avalanche delegation does not match the expected public key.");
139 uint64_t mempool_sequence)
override {
147 std::unique_ptr<PeerData> peerDataIn,
CKey sessionKeyIn,
148 uint32_t minQuorumTotalScoreIn,
149 double minQuorumConnectedScoreRatioIn,
150 int64_t minAvaproofsNodeCountIn,
151 uint32_t staleVoteThresholdIn, uint32_t staleVoteFactorIn,
152 Amount stakeUtxoDustThreshold,
bool preConsensus)
153 : avaconfig(
std::move(avaconfigIn)), connman(connmanIn),
154 chainman(chainmanIn), mempool(mempoolIn),
157 stakeUtxoDustThreshold, chainman,
158 peerDataIn ? peerDataIn->proof :
ProofRef())),
159 peerData(
std::move(peerDataIn)), sessionKey(
std::move(sessionKeyIn)),
160 minQuorumScore(minQuorumTotalScoreIn),
161 minQuorumConnectedScoreRatio(minQuorumConnectedScoreRatioIn),
162 minAvaproofsNodeCount(minAvaproofsNodeCountIn),
163 staleVoteThreshold(staleVoteThresholdIn),
164 staleVoteFactor(staleVoteFactorIn), m_preConsensus(preConsensus) {
171 std::unordered_set<ProofRef, SaltedProofHasher> registeredProofs;
173 peerManager->cleanupDanglingProofs(registeredProofs));
174 for (
const auto &proof : registeredProofs) {
176 "Promoting previously dangling proof %s\n",
177 proof->getId().ToString());
188 std::unordered_set<ProofRef, SaltedProofHasher> registeredProofs;
193 dumpPath, registeredProofs));
198 for (
const auto &proof : registeredProofs) {
219 std::unique_ptr<Processor>
229 if (argsman.
IsArgSet(
"-avaproofstakeutxodustthreshold") &&
231 stakeUtxoDustThreshold)) {
232 error =
_(
"The avalanche stake utxo dust threshold amount is invalid.");
236 if (argsman.
IsArgSet(
"-avasessionkey")) {
239 error =
_(
"The avalanche session key is invalid.");
247 if (argsman.
IsArgSet(
"-avaproof")) {
248 if (!argsman.
IsArgSet(
"-avamasterkey")) {
250 "The avalanche master key is missing for the avalanche proof.");
256 error =
_(
"The avalanche master key is invalid.");
266 peerData = std::make_unique<PeerData>();
273 std::unique_ptr<DelegationBuilder> dgb;
276 if (argsman.
IsArgSet(
"-avadelegation")) {
285 error =
_(
"The delegation does not match the proof.");
291 "The master key does not match the delegation public key.");
295 dgb = std::make_unique<DelegationBuilder>(dg);
297 if (masterPubKey !=
peerData->proof->getMaster()) {
299 _(
"The master key does not match the proof public key.");
303 dgb = std::make_unique<DelegationBuilder>(*
peerData->proof);
308 if (sessionPubKey != masterPubKey) {
309 if (!dgb->addLevel(masterKey, sessionPubKey)) {
310 error =
_(
"Failed to generate a delegation for this session.");
314 peerData->delegation = dgb->build();
322 const auto queryTimeoutDuration =
323 std::chrono::milliseconds(argsman.
GetIntArg(
328 if (argsman.
IsArgSet(
"-avaminquorumstake") &&
330 error =
_(
"The avalanche min quorum stake amount is invalid.");
335 error =
_(
"The avalanche min quorum stake amount is out of range.");
339 double minQuorumConnectedStakeRatio =
341 if (argsman.
IsArgSet(
"-avaminquorumconnectedstakeratio") &&
343 &minQuorumConnectedStakeRatio)) {
344 error =
_(
"The avalanche min quorum connected stake ratio is invalid.");
348 if (minQuorumConnectedStakeRatio < 0 || minQuorumConnectedStakeRatio > 1) {
350 "The avalanche min quorum connected stake ratio is out of range.");
355 argsman.
GetIntArg(
"-avaminavaproofsnodecount",
358 error =
_(
"The minimum number of node that sent avaproofs message "
359 "should be non-negative");
368 "greater than or equal to %d"),
374 "than or equal to %d"),
375 std::numeric_limits<uint32_t>::max());
382 error =
_(
"The avalanche stale vote factor must be greater than 0");
386 error =
strprintf(
_(
"The avalanche stale vote factor must be less than "
388 std::numeric_limits<uint32_t>::max());
395 return std::unique_ptr<Processor>(
new Processor(
400 stakeUtxoDustThreshold,
406 return item.valueless_by_exception() ||
407 std::visit([](
const auto &item) {
return item ==
nullptr; }, item);
424 ->insert(std::make_pair(item,
VoteRecord(accepted)))
436 if (peerManager->forPeer(proof->getId(), [&](
const Peer &peer) {
437 peerid = peer.peerid;
440 return peerManager->setFinalized(peerid);
453 auto it = r->find(item);
458 return it->second.isAccepted();
467 auto it = r->find(item);
472 return it->second.getConfidence();
481 finalizedItems.reset();
494 TCPResponse(Response responseIn,
const CKey &key)
521 std::vector<VoteItemUpdate> &updates,
522 int &banscore, std::string &
error) {
530 peerManager->updateNextRequestTime(
531 nodeid, Now<SteadyMilliseconds>() +
532 std::chrono::milliseconds(
response.getCooldown()));
535 std::vector<CInv> invs;
543 auto it = w->find(std::make_tuple(nodeid,
response.getRound()));
546 error =
"unexpected-ava-response";
550 invs = std::move(it->invs);
555 const std::vector<Vote> &votes =
response.GetVotes();
556 size_t size = invs.size();
557 if (votes.size() != size) {
559 error =
"invalid-ava-response-size";
563 for (
size_t i = 0; i < size; i++) {
564 if (invs[i].hash != votes[i].GetHash()) {
566 error =
"invalid-ava-response-content";
571 std::map<AnyVoteItem, Vote, VoteMapComparator> responseItems(
576 for (
size_t i = 0; i < size; i++) {
589 responseItems.insert(std::make_pair(std::move(item), votes[i]));
595 for (
const auto &p : responseItems) {
597 const Vote &v = p.second;
599 auto it = voteRecordsWriteView->find(item);
600 if (it == voteRecordsWriteView.end()) {
605 auto &vr = it->second;
606 if (!vr.registerVote(nodeid, v.
GetError())) {
612 voteRecordsWriteView->erase(it);
618 if (!vr.hasFinalized()) {
621 updates.emplace_back(std::move(item), vr.isAccepted()
629 updates.emplace_back(std::move(item), vr.isAccepted()
632 voteRecordsWriteView->erase(it);
637 for (
const auto &update : updates) {
643 const auto &item = update.getVoteItem();
652 if (!std::holds_alternative<const CBlockIndex *>(item)) {
668 const CBlockIndex *pindex = std::get<const CBlockIndex *>(item);
670 if (finalizationTip &&
671 finalizationTip->GetAncestor(pindex->
nHeight) == pindex) {
675 finalizationTip = pindex;
691 if (!delayedAvahelloNodeIds.emplace(pfrom->
GetId()).second) {
701 hasher << delegation.
getId();
728 auto it = delayedAvahelloNodeIds.begin();
729 while (it != delayedAvahelloNodeIds.end()) {
735 it = delayedAvahelloNodeIds.erase(it);
764 if (
chainman.ActiveChainstate().IsInitialBlockDownload()) {
773 if (peerManager->latchAvaproofsSent(nodeid)) {
787 if (peerManager->getNodeCount() < 8) {
809 if (
chainman.ActiveChainstate().IsInitialBlockDownload()) {
820 uint32_t totalPeersScore;
821 uint32_t connectedPeersScore;
824 totalPeersScore = peerManager->getTotalPeersScore();
825 connectedPeersScore = peerManager->getConnectedPeersScore();
830 peerManager->forPeer(localProof->getId(), [](
const Peer &peer) {
831 return peer.node_count == 0;
833 connectedPeersScore += localProof->getScore();
843 uint32_t minConnectedScore =
845 if (connectedPeersScore < minConnectedScore) {
855 GetConfig().GetChainParams().GetConsensus(), pprev)) {
898 pindex, _stakingRewards.
winners))) {
900 return stakingRewards
901 .emplace(pindex->
GetBlockHash(), std::move(_stakingRewards))
910 return stakingRewards.erase(prevBlockHash) > 0;
916 for (
auto it = stakingRewards.begin(); it != stakingRewards.end();) {
917 if (it->second.blockheight < minHeight) {
918 it = stakingRewards.erase(it);
926 std::vector<CScript> &winners)
const {
928 auto it = stakingRewards.find(prevBlockHash);
929 if (it == stakingRewards.end()) {
933 winners = it->second.winners;
938 const std::vector<CScript> &winners) {
943 stakingReward.
winners = winners;
946 return stakingRewards.insert_or_assign(pprev->
GetBlockHash(), stakingReward)
960 auto registerProofs = [&]() {
963 auto registeredProofs = peerManager->updatedBlockTip();
967 if (peerManager->registerProof(
peerData->proof, localProofState)) {
968 registeredProofs.insert(
peerData->proof);
979 if (peerManager->isImmature(localProofId)) {
983 if (peerManager->isInConflictingPool(localProofId)) {
986 "conflicting-utxos");
988 if (peerManager->isBoundToPeer(localProofId)) {
994 peerData->proofState = std::move(localProofState));
997 return registeredProofs;
1000 auto registeredProofs = registerProofs();
1001 for (
const auto &proof : registeredProofs) {
1044 uint64_t current_round =
round++;
1048 auto timeout = Now<SteadyMilliseconds>() +
1052 {pnode->
GetId(), current_round, timeout, invs});
1054 peerManager->updateNextRequestTime(pnode->
GetId(), timeout);
1063 Poll(current_round, std::move(invs))));
1073 peerManager->removeNode(nodeid);
1076 nodeid = peerManager->selectNode();
1081 auto now = Now<SteadyMilliseconds>();
1082 std::map<CInv, uint8_t> timedout_items{};
1088 while (it != w->get<
query_timeout>().end() && it->timeout < now) {
1089 for (
const auto &i : it->invs) {
1090 timedout_items[i]++;
1097 if (timedout_items.empty()) {
1103 for (
const auto &p : timedout_items) {
1110 auto it = voteRecordsWriteView->find(item);
1111 if (it == voteRecordsWriteView.end()) {
1115 it->second.clearInflightRequest(p.second);
1120 std::vector<CInv> invs;
1125 for (
auto it = w->begin(); it != w->end();) {
1145 for (
const auto &[item, voteRecord] : r) {
1152 const bool shouldPoll =
1153 forPoll ? voteRecord.registerPoll() : voteRecord.shouldPoll();
1159 invs.emplace_back(std::visit(buildInvFromVoteItem, item));
1188 if (pindex->nStatus.isInvalid()) {
1196 pindex->
nHeight) == pindex)) {
1203 return processor.invalidatedBlocks.contains(
1217 const ProofId &proofid = proof->getId();
1219 LOCK(processor.cs_peerManager);
1222 return processor.peerManager->isBoundToPeer(proofid) ||
1223 processor.peerManager->isInConflictingPool(proofid);
1227 if (!processor.mempool) {
1235 return processor.mempool->exists(tx->GetId()));
1248 return processor.chainman.ActiveChain().Contains(pindex));
1255 processor.cs_peerManager,
1256 return processor.peerManager->isBoundToPeer(proof->getId()));
1261 if (!processor.mempool) {
1268 return processor.mempool->exists(tx->GetId()));
bool MoneyRange(const Amount nValue)
static constexpr bool DEFAULT_PERSIST_AVAPEERS
Default for -persistavapeers.
static constexpr double AVALANCHE_DEFAULT_MIN_QUORUM_CONNECTED_STAKE_RATIO
Default minimum percentage of stake-weighted peers we must have a node for to constitute a usable quo...
static constexpr double AVALANCHE_DEFAULT_MIN_AVAPROOFS_NODE_COUNT
Default minimum number of nodes that sent us an avaproofs message before we can consider our quorum s...
static constexpr bool DEFAULT_AVALANCHE_PRECONSENSUS
Default for -avalanchepreconsensus.
static constexpr Amount AVALANCHE_DEFAULT_MIN_QUORUM_STAKE
Default minimum cumulative stake of all known peers that constitutes a usable quorum.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
The block chain is a tree shaped structure starting with the genesis block at the root,...
BlockHash GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
size_t GetNodeCount(NumConnections num) const
bool ForNode(NodeId id, std::function< bool(CNode *pnode)> func)
void PushMessage(CNode *pnode, CSerializedNetMsg &&msg)
A writer stream (for serialization) that computes a 256-bit hash.
uint256 GetHash()
Compute the double-SHA256 hash of all data written to this object.
Inv(ventory) message data.
An encapsulated secp256k1 private key.
bool IsValid() const
Check whether this private key is valid.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
CPubKey GetPubKey() const
Compute the public key from a private key.
bool SignSchnorr(const uint256 &hash, SchnorrSig &sig, uint32_t test_case=0) const
Create a Schnorr signature.
CSerializedNetMsg Make(int nFlags, std::string msg_type, Args &&...args) const
Information about a peer.
uint64_t GetLocalNonce() const
int GetCommonVersion() const
uint64_t nRemoteHostNonce
uint64_t nRemoteExtraEntropy
uint64_t GetLocalExtraEntropy() const
void invsPolled(uint32_t count)
The node was polled for count invs.
An encapsulated public key.
Simple class for background tasks that should be run periodically or once "after a while".
void scheduleEvery(Predicate p, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Repeat p until it return false.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
CTransactionRef get(const TxId &txid) const
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
CBlockIndex * ActiveTip() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
static RCUPtr make(Args &&...args)
Construct a new object that is owned by the pointer.
ReadView getReadView() const
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
ProofId getProofId() const
static bool FromHex(Delegation &dg, const std::string &dgHex, bilingual_str &errorOut)
bool verify(DelegationState &state, CPubKey &auth) const
const LimitedProofId & getLimitedProofId() const
const CPubKey & getDelegatedPubkey() const
const DelegationId & getId() const
void updatedBlockTip() override
NotificationsHandler(Processor *p)
void transactionAddedToMempool(const CTransactionRef &tx, uint64_t mempool_sequence) override
void sendResponse(CNode *pfrom, Response response) const
const uint32_t staleVoteThreshold
Voting parameters.
std::atomic< bool > quorumIsEstablished
AnyVoteItem getVoteItemFromInv(const CInv &inv) const EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Mutex cs_finalizedItems
Rolling bloom filter to track recently finalized inventory items of any type.
bool sendHelloInternal(CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(cs_delayedAvahelloNodeIds)
int getConfidence(const AnyVoteItem &item) const
bool addToReconcile(const AnyVoteItem &item) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
std::vector< CInv > getInvsForNextPoll(bool forPoll=true) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
RWCollection< QuerySet > queries
bool getStakingRewardWinners(const BlockHash &prevBlockHash, std::vector< CScript > &winners) const EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
bool registerVotes(NodeId nodeid, const Response &response, std::vector< VoteItemUpdate > &updates, int &banscore, std::string &error) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
void transactionAddedToMempool(const CTransactionRef &tx) EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
bool sendHello(CNode *pfrom) EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
Send a avahello message.
bool isRecentlyFinalized(const uint256 &itemId) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
bool startEventLoop(CScheduler &scheduler)
bool isQuorumEstablished() LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
std::atomic< uint64_t > round
Keep track of peers and queries sent.
bool canShareLocalProof()
static std::unique_ptr< Processor > MakeProcessor(const ArgsManager &argsman, interfaces::Chain &chain, CConnman *connman, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, bilingual_str &error)
EventLoop eventLoop
Event loop machinery.
int64_t minAvaproofsNodeCount
const bool m_preConsensus
Mutex cs_delayedAvahelloNodeIds
void runEventLoop() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Mutex cs_invalidatedBlocks
We don't need many blocks but a low false positive rate.
void updatedBlockTip() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
RWCollection< VoteMap > voteRecords
Items to run avalanche on.
std::unique_ptr< interfaces::Handler > chainNotificationsHandler
uint32_t minQuorumScore
Quorum management.
void FinalizeNode(const ::Config &config, const CNode &node) override LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
Handle removal of a node.
std::atomic< bool > m_canShareLocalProof
bool isAccepted(const AnyVoteItem &item) const
ProofRef getLocalProof() const
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...
const uint32_t staleVoteFactor
void sendDelayedAvahello() EXCLUSIVE_LOCKS_REQUIRED(!cs_delayedAvahelloNodeIds)
std::unique_ptr< PeerData > peerData
bool eraseStakingRewardWinner(const BlockHash &prevBlockHash) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
bool setStakingRewardWinners(const CBlockIndex *pprev, const std::vector< CScript > &winners) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
bool isWorthPolling(const AnyVoteItem &item) const EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
CPubKey getSessionPubKey() const
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)
ChainstateManager & chainman
std::atomic< int64_t > avaproofsNodeCounter
bool computeStakingReward(const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager
ProofRegistrationState getLocalProofRegistrationState() const
void cleanupStakingRewards(const int minHeight) EXCLUSIVE_LOCKS_REQUIRED(!cs_stakingRewards)
void clearTimedoutRequests() EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
Mutex cs_peerManager
Keep track of the peers and associated infos.
bool getLocalAcceptance(const AnyVoteItem &item) const
void avaproofsSent(NodeId nodeid) LOCKS_EXCLUDED(cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_peerManager)
double minQuorumConnectedScoreRatio
void clearFinalizedItems() EXCLUSIVE_LOCKS_REQUIRED(!cs_finalizedItems)
static bool FromHex(Proof &proof, const std::string &hexProof, bilingual_str &errorOut)
bool verify(const Amount &stakeUtxoDustThreshold, ProofValidationState &state) const
static uint32_t amountToScore(Amount amount)
uint32_t GetError() const
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
virtual std::unique_ptr< Handler > handleNotifications(std::shared_ptr< Notifications > notifications)=0
Register handler for notifications.
CBlockIndex * LookupBlockIndex(const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
static const uint256 ZERO
const Config & GetConfig()
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::array< uint8_t, CPubKey::SCHNORR_SIZE > SchnorrSig
a Schnorr signature
CKey DecodeSecret(const std::string &str)
#define LogPrint(category,...)
bool ParseMoney(const std::string &money_string, Amount &nRet)
Parse an amount denoted in full coins.
const char * AVAHELLO
Contains a delegation and a signature.
const char * AVARESPONSE
Contains an avalanche::Response.
const char * AVAPOLL
Contains an avalanche::Poll.
static constexpr Amount PROOF_DUST_THRESHOLD
Minimum amount per utxo.
std::map< AnyVoteItem, VoteRecord, VoteMapComparator > VoteMap
@ INVALID_STAKE_SIGNATURE
static bool VerifyDelegation(const Delegation &dg, const CPubKey &expectedPubKey, bilingual_str &error)
static bool isNull(const AnyVoteItem &item)
std::variant< const ProofRef, const CBlockIndex *, const CTransactionRef > AnyVoteItem
static const uint256 GetVoteItemId(const AnyVoteItem &item)
static bool VerifyProof(const Amount &stakeUtxoDustThreshold, const Proof &proof, bilingual_str &error)
RCUPtr< const Proof > ProofRef
static std::string PathToString(const path &path)
Convert path object to byte string.
Implement std::hash so RCUPtr can be used as a key for maps or sets.
static constexpr NodeId NO_NODE
Special NodeId that represent no node.
std::shared_ptr< const CTransaction > CTransactionRef
static const std::string AVAPEERS_FILE_NAME
static constexpr std::chrono::milliseconds AVALANCHE_TIME_STEP
Run the avalanche event loop every 10ms.
std::unique_ptr< avalanche::Processor > g_avalanche
Global avalanche instance.
static constexpr std::chrono::milliseconds AVALANCHE_DEFAULT_QUERY_TIMEOUT
How long before we consider that a query timed out.
static constexpr size_t AVALANCHE_MAX_ELEMENT_POLL
Maximum item that can be polled at once.
static constexpr int AVALANCHE_MAX_PROOF_STAKES
How many UTXOs can be used for a single proof.
#define SERIALIZE_METHODS(cls, obj)
Implement the Serialize and Unserialize methods by delegating to a single templated static method tha...
bool IsStakingRewardsActivated(const Consensus::Params ¶ms, const CBlockIndex *pprev)
bool ParseDouble(const std::string &str, double *out)
Convert string to double with strict parse error feedback.
A BlockHash is a unqiue identifier for a block.
bool stopEventLoop() EXCLUSIVE_LOCKS_REQUIRED(!cs_running)
bool startEventLoop(CScheduler &scheduler, std::function< void()> runEventLoop, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!cs_running)
A TxId is the identifier of a transaction.
const std::chrono::milliseconds queryTimeoutDuration
bool operator()(const CBlockIndex *pindex) const LOCKS_EXCLUDED(cs_main)
const Processor & processor
bool operator()(const CBlockIndex *pindex) const LOCKS_EXCLUDED(cs_main)
ProofRegistrationState proofState GUARDED_BY(cs_proofState)
std::vector< CScript > winners
#define AssertLockNotHeld(cs)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
bool error(const char *fmt, const Args &...args)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
bilingual_str _(const char *psz)
Translation function.
static constexpr uint32_t AVALANCHE_VOTE_STALE_FACTOR
Scaling factor applied to confidence to determine staleness threshold.
static constexpr uint32_t AVALANCHE_VOTE_STALE_MIN_THRESHOLD
Lowest configurable staleness threshold (finalization score + necessary votes to increase confidence ...
static constexpr uint32_t AVALANCHE_VOTE_STALE_THRESHOLD
Number of votes before a record may be considered as stale.