MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetCurrentMasterNode

Function GetCurrentMasterNode

src/masternode.cpp:448–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448int GetCurrentMasterNode(int mod, int64_t nBlockHeight, int minProtocol) {
449 int i = 0;
450 unsigned int score = 0;
451 int winner = -1;
452 //LOCK(cs_masternodes);
453 // scan for winner
454 for (CMasterNode mn : vecMasternodes) {
455 mn.Check();
456 if (mn.protocolVersion < minProtocol) continue;
457 if (!mn.IsEnabled()) {
458 i++;
459 continue;
460 }
461
462 // calculate the score for each masternode
463 uint256 n = mn.CalculateScore(mod, nBlockHeight);
464 unsigned int n2 = 0;
465 memcpy(&n2, &n, sizeof(n2));
466
467 // determine the winner
468 if (n2 > score) {
469 score = n2;
470 winner = i;
471 }
472 i++;
473 }
474 return winner;
475}
476
477int GetMasternodeByRank(int findRank, int64_t nBlockHeight, int minProtocol) {
478 LOCK(cs_masternodes);

Callers 3

SelectMasternodePayeeFunction · 0.85
getpoolinfoFunction · 0.85
masternodeFunction · 0.85

Calls 4

memcpyFunction · 0.85
IsEnabledMethod · 0.80
CalculateScoreMethod · 0.80
CheckMethod · 0.45

Tested by

no test coverage detected