Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
deterministicmns.h
Go to the documentation of this file.
257 for (typename immer::map<K, T, Hash, Equal>::const_iterator mi = m.begin(); mi != m.end(); ++mi)
273 // For some reason the compiler is not able to choose the correct Serialize/Deserialize methods without a specialized
276 inline void SerReadWrite(Stream& s, const immer::map<K, T, Hash, Equal>& m, CSerActionSerialize ser_action)
282 inline void SerReadWrite(Stream& s, immer::map<K, T, Hash, Equal>& obj, CSerActionUnserialize ser_action)
308 explicit CDeterministicMNList(const uint256& _blockHash, int _height, uint32_t _totalRegisteredCount) :
437 std::vector<CDeterministicMNCPtr> CalculateQuorum(size_t maxSize, const uint256& modifier) const;
438 std::vector<std::pair<arith_uint256, CDeterministicMNCPtr>> CalculateScores(const uint256& modifier) const;
475 CDeterministicMNList ApplyDiff(const CBlockIndex* pindex, const CDeterministicMNListDiff& diff) const;
526 mnUniquePropertyMap = mnUniquePropertyMap.set(oldHash, std::make_pair(dmn->proTxHash, p->second - 1));
530 void UpdateUniqueProperty(const CDeterministicMNCPtr& dmn, const T& oldValue, const T& newValue)
625 // of this dmn via corresponding ctor when we convert the diff format to a new one in UpgradeDiff
626 // thus the logic that we must set internalId before dmn is used in any meaningful way is preserved.
640 static const int DISK_SNAPSHOTS = 3; // keep cache for 3 disk snapshots to have 2 full days covered
656 bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck);
661 // the returned list will not contain the correct block hash (we can't know it yet as the coinbase TX is not updated yet)
662 bool BuildNewListFromBlock(const CBlock& block, const CBlockIndex* pindexPrev, CValidationState& state, CDeterministicMNList& mnListRet, bool debugLogs);
663 void HandleQuorumCommitment(llmq::CFinalCommitment& qc, const CBlockIndex* pindexQuorum, CDeterministicMNList& mnList, bool debugLogs);
676 void UpgradeDiff(CDBBatch& batch, const CBlockIndex* pindexNext, const CDeterministicMNList& curMNList, CDeterministicMNList& newMNList);
int CalcMaxPoSePenalty() const
Calculates the maximum penalty which is allowed at the height of this MN list.
Definition: deterministicmns.cpp:301
Definition: deterministicmns.h:637
CDeterministicMNList GetListAtChainTip()
Definition: deterministicmns.cpp:989
CDeterministicMNManager(CEvoDB &_evoDb)
Definition: deterministicmns.cpp:528
CDeterministicMNCPtr GetValidMN(const uint256 &proTxHash) const
Definition: deterministicmns.cpp:143
void SetBlockHash(const uint256 &_blockHash)
Definition: deterministicmns.h:380
void PoSePunish(const uint256 &proTxHash, int penalty, bool debugLogs)
Punishes a MN for misbehavior.
Definition: deterministicmns.cpp:315
void SerializationOp(Stream &s, Operation ser_action)
Definition: deterministicmns.h:73
void UpdatedBlockTip(const CBlockIndex *pindex)
Definition: deterministicmns.cpp:641
CDeterministicMNCPtr GetUniquePropertyMN(const T &v) const
Definition: deterministicmns.h:489
Definition: quorums_commitment.h:24
Definition: simplifiedmns.h:106
Definition: evodb.h:32
Definition: deterministicmns.h:547
CDeterministicMNStateDiff(const CDeterministicMNState &a, const CDeterministicMNState &b)
Definition: deterministicmns.h:163
CDeterministicMNList(const uint256 &_blockHash, int _height, uint32_t _totalRegisteredCount)
Definition: deterministicmns.h:308
void UnserializeImmerMap(Stream &is, immer::map< K, T, Hash, Equal > &m)
Definition: deterministicmns.h:262
Definition: block.h:72
CDeterministicMNCPtr GetMN(const uint256 &proTxHash) const
Definition: deterministicmns.cpp:134
void WriteCompactSize(CSizeComputer &os, uint64_t nSize)
Definition: serialize.h:1289
size_t GetValidMNsCount() const
Definition: deterministicmns.h:354
std::set< uint256 > removedMns
Definition: deterministicmns.h:612
void BanIfNotBanned(int height)
Definition: deterministicmns.h:98
CScript scriptOperatorPayout
Definition: deterministicmns.h:52
void SerializeImmerMap(Stream &os, const immer::map< K, T, Hash, Equal > &m)
Definition: deterministicmns.h:254
void UpdateMN(const CDeterministicMNCPtr &oldDmn, const CDeterministicMNStateCPtr &pdmnState)
Definition: deterministicmns.cpp:474
void ApplyToState(CDeterministicMNState &target) const
Definition: deterministicmns.h:181
std::shared_ptr< const CDeterministicMNState > CDeterministicMNStateCPtr
Definition: deterministicmns.h:118
std::vector< CDeterministicMNCPtr > GetProjectedMNPayees(int nCount) const
Calculates the projected MN payees for the next count blocks.
Definition: deterministicmns.cpp:232
Definition: serialize.h:1163
void UpgradeDiff(CDBBatch &batch, const CBlockIndex *pindexNext, const CDeterministicMNList &curMNList, CDeterministicMNList &newMNList)
Definition: deterministicmns.cpp:1078
void AddMN(const CDeterministicMNCPtr &dmn, bool fBumpTotalCount=true)
Definition: deterministicmns.cpp:441
uint256 confirmedHashWithProRegTxHash
Definition: deterministicmns.h:45
Definition: univalue.h:20
CDeterministicMNStateDiff()
Definition: deterministicmns.h:162
static const int DISK_SNAPSHOTS
Definition: deterministicmns.h:640
bool IsMNValid(const uint256 &proTxHash) const
Definition: deterministicmns.cpp:104
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
Definition: deterministicmns.h:249
Definition: deterministicmns.h:26
void Unserialize(Stream &s, bool oldFormat=false)
Definition: deterministicmns.h:239
CDeterministicMNListDiff BuildDiff(const CDeterministicMNList &to) const
Definition: deterministicmns.cpp:358
bool IsDIP3Enforced(int nHeight=-1)
Definition: deterministicmns.cpp:1020
void SerializationOp(Stream &s, Operation ser_action)
Definition: deterministicmns.h:173
void AddUniqueProperty(const CDeterministicMNCPtr &dmn, const T &v)
Definition: deterministicmns.h:500
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
Definition: deterministicmns.cpp:24
void ForEachMN(bool onlyValid, Callback &&cb) const
Definition: deterministicmns.h:366
CDeterministicMN(const CDeterministicMN &mn, uint64_t _internalId)
Definition: deterministicmns.h:202
std::shared_ptr< CDeterministicMNState > CDeterministicMNStatePtr
Definition: deterministicmns.h:117
uint32_t nTotalRegisteredCount
Definition: deterministicmns.h:298
void SerializationOp(Stream &s, Operation ser_action, bool oldFormat)
Definition: deterministicmns.h:221
std::vector< CDeterministicMNCPtr > CalculateQuorum(size_t maxSize, const uint256 &modifier) const
Calculate a quorum based on the modifier.
Definition: deterministicmns.cpp:253
CDeterministicMNCPtr GetMNByInternalId(uint64_t internalId) const
Definition: deterministicmns.cpp:181
Definition: callback.h:6
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
Definition: hash.h:254
MnUniquePropertyMap mnUniquePropertyMap
Definition: deterministicmns.h:304
immer::map< uint256, CDeterministicMNCPtr > MnMap
Definition: deterministicmns.h:291
CDeterministicMNCPtr GetValidMNByCollateral(const COutPoint &collateralOutpoint) const
Definition: deterministicmns.cpp:167
CDeterministicMNCPtr GetMNPayee() const
Definition: deterministicmns.cpp:216
static const int DISK_SNAPSHOT_PERIOD
Definition: deterministicmns.h:639
Definition: deterministicmns.h:288
const uint256 & GetBlockHash() const
Definition: deterministicmns.h:376
void Unserialize(Stream &s)
Definition: deterministicmns.h:616
std::unordered_map< uint256, CDeterministicMNList, StaticSaltedHasher > mnListsCache
Definition: deterministicmns.h:649
CDeterministicMN(uint64_t _internalId)
Definition: deterministicmns.h:196
CDeterministicMNState(deserialize_type, Stream &s)
Definition: deterministicmns.h:65
Definition: bls.h:263
void HandleQuorumCommitment(llmq::CFinalCommitment &qc, const CBlockIndex *pindexQuorum, CDeterministicMNList &mnList, bool debugLogs)
Definition: deterministicmns.cpp:882
void UpdateUniqueProperty(const CDeterministicMNCPtr &dmn, const T &oldValue, const T &newValue)
Definition: deterministicmns.h:530
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:143
static const int LIST_DIFFS_CACHE_SIZE
Definition: deterministicmns.h:641
void PoSeDecrease(const uint256 &proTxHash)
Decrease penalty score of MN by 1.
Definition: deterministicmns.cpp:345
CDeterministicMN()=delete
uint32_t GetTotalRegisteredCount() const
Definition: deterministicmns.h:392
void Serialize(Stream &s) const
Definition: deterministicmns.h:559
void UpdateConfirmedHash(const uint256 &_proTxHash, const uint256 &_confirmedHash)
Definition: deterministicmns.h:104
Definition: deterministicmns.h:189
uint256 prevBlockHash
Definition: deterministicmns.h:607
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
bool BuildNewListFromBlock(const CBlock &block, const CBlockIndex *pindexPrev, CValidationState &state, CDeterministicMNList &mnListRet, bool debugLogs)
Definition: deterministicmns.cpp:648
bool IsProTxWithCollateral(const CTransactionRef &tx, uint32_t n)
Definition: deterministicmns.cpp:998
Support for ADD_SERIALIZE_METHODS and READWRITE macro.
Definition: serialize.h:1159
bool IsMNPoSeBanned(const uint256 &proTxHash) const
Definition: deterministicmns.cpp:113
Definition: deterministicmns.h:31
immer::map< uint256, std::pair< uint256, uint32_t > > MnUniquePropertyMap
Definition: deterministicmns.h:293
void DeleteUniqueProperty(const CDeterministicMNCPtr &dmn, const T &oldValue)
Definition: deterministicmns.h:515
Definition: map.hpp:64
CBLSLazyPublicKey pubKeyOperator
Definition: deterministicmns.h:48
std::map< uint256, CDeterministicMNStateCPtr > updatedMNs
Definition: deterministicmns.h:611
Definition: deterministicmns.h:120
CDeterministicMNCPtr GetMNByOperatorKey(const CBLSPublicKey &pubKey)
Definition: deterministicmns.cpp:152
CDeterministicMNState()
Definition: deterministicmns.h:55
void SerializationOpBase(Stream &s, Operation ser_action)
Definition: deterministicmns.h:316
void CleanupCache(int nHeight)
Definition: deterministicmns.cpp:1031
bool HasMN(const uint256 &proTxHash) const
Definition: deterministicmns.h:402
CSimplifiedMNListDiff BuildSimplifiedDiff(const CDeterministicMNList &to) const
Definition: deterministicmns.cpp:389
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
ADD_SERIALIZE_METHODS
Definition: deterministicmns.h:170
bool UpgradeDBIfNeeded()
Definition: deterministicmns.cpp:1130
void DecreasePoSePenalties(CDeterministicMNList &mnList)
Definition: deterministicmns.cpp:902
CDeterministicMN(deserialize_type, Stream &s)
Definition: deterministicmns.h:209
bool HasUniqueProperty(const T &v) const
Definition: deterministicmns.h:484
bool ProcessBlock(const CBlock &block, const CBlockIndex *pindex, CValidationState &state, bool fJustCheck)
Definition: deterministicmns.cpp:533
void ResetOperatorFields()
Definition: deterministicmns.h:91
MnInternalIdMap mnInternalIdMap
Definition: deterministicmns.h:300
void SerReadWrite(Stream &s, const immer::map< K, T, Hash, Equal > &m, CSerActionSerialize ser_action)
Definition: deterministicmns.h:276
std::vector< CDeterministicMNCPtr > addedMNs
Definition: deterministicmns.h:552
immer::map< uint64_t, uint256 > MnInternalIdMap
Definition: deterministicmns.h:292
CDeterministicMNList ApplyDiff(const CBlockIndex *pindex, const CDeterministicMNListDiff &diff) const
Definition: deterministicmns.cpp:417
bool UndoBlock(const CBlock &block, const CBlockIndex *pindex)
Definition: deterministicmns.cpp:605
T * NCONST_PTR(const T *val)
Used to acquire a non-const pointer "this" to generate bodies of const serialization operations from ...
Definition: serialize.h:60
CDeterministicMNList GetListForBlock(const CBlockIndex *pindex)
Definition: deterministicmns.cpp:919
std::set< uint64_t > removedMns
Definition: deterministicmns.h:555
std::map< uint256, CDeterministicMNCPtr > addedMNs
Definition: deterministicmns.h:610
Definition: providertx.h:19
int CalcPenalty(int percent) const
Returns a the given percentage from the max penalty for this MN list.
Definition: deterministicmns.cpp:309
bool HasValidMNByCollateral(const COutPoint &collateralOutpoint) const
Definition: deterministicmns.h:410
std::vector< std::pair< arith_uint256, CDeterministicMNCPtr > > CalculateScores(const uint256 &modifier) const
Definition: deterministicmns.cpp:275
CDeterministicMNCPtr GetMNByCollateral(const COutPoint &collateralOutpoint) const
Definition: deterministicmns.cpp:162
std::map< uint64_t, CDeterministicMNStateDiff > updatedMNs
Definition: deterministicmns.h:554
void RemoveMN(const uint256 &proTxHash)
Definition: deterministicmns.cpp:510
std::unordered_map< uint256, CDeterministicMNListDiff, StaticSaltedHasher > mnListDiffsCache
Definition: deterministicmns.h:650
CDeterministicMNState(const CProRegTx &proTx)
Definition: deterministicmns.h:56
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the re...
Definition: sync.h:94
bool HasMNByCollateral(const COutPoint &collateralOutpoint) const
Definition: deterministicmns.h:406
CDeterministicMNCPtr GetMNByService(const CService &service) const
Definition: deterministicmns.cpp:176