Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct Peer { | struct Peer { | ||||
PeerId peerid; | PeerId peerid; | ||||
uint32_t index = -1; | uint32_t index = -1; | ||||
uint32_t node_count = 0; | uint32_t node_count = 0; | ||||
ProofRef proof; | ProofRef proof; | ||||
bool hasFinalized = false; | |||||
// The network stack uses timestamp in seconds, so we oblige. | // The network stack uses timestamp in seconds, so we oblige. | ||||
std::chrono::seconds registration_time; | std::chrono::seconds registration_time; | ||||
std::chrono::seconds nextPossibleConflictTime; | std::chrono::seconds nextPossibleConflictTime; | ||||
/** | /** | ||||
* Consider dropping the peer if no node is attached after this timeout | * Consider dropping the peer if no node is attached after this timeout | ||||
* expired. | * expired. | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Update the time before which a proof is not allowed to have conflicting | * Update the time before which a proof is not allowed to have conflicting | ||||
* UTXO with this peer's proof. | * UTXO with this peer's proof. | ||||
*/ | */ | ||||
bool updateNextPossibleConflictTime(PeerId peerid, | bool updateNextPossibleConflictTime(PeerId peerid, | ||||
const std::chrono::seconds &nextTime); | const std::chrono::seconds &nextTime); | ||||
/** | /** | ||||
* Latch on that this peer has a finalized proof. | |||||
*/ | |||||
bool setFinalized(PeerId peerid); | |||||
/** | |||||
* Registration mode | * Registration mode | ||||
* - DEFAULT: Default policy, register only if the proof is unknown and has | * - DEFAULT: Default policy, register only if the proof is unknown and has | ||||
* no conflict. | * no conflict. | ||||
* - FORCE_ACCEPT: Turn a valid proof into a peer even if it has conflicts | * - FORCE_ACCEPT: Turn a valid proof into a peer even if it has conflicts | ||||
* and is not the best candidate. | * and is not the best candidate. | ||||
*/ | */ | ||||
enum class RegistrationMode { | enum class RegistrationMode { | ||||
DEFAULT, | DEFAULT, | ||||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |