mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
New improved masternode calculation
This commit is contained in:
parent
412f54fe8a
commit
a950049541
@ -3112,6 +3112,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Check for duplicate
|
// Check for duplicate
|
||||||
uint256 hash = pblock->GetHash();
|
uint256 hash = pblock->GetHash();
|
||||||
if (mapBlockIndex.count(hash))
|
if (mapBlockIndex.count(hash))
|
||||||
|
@ -546,15 +546,11 @@ uint256 CMasterNode::CalculateScore(int mod, int64_t nBlockHeight)
|
|||||||
if(chainActive.Tip() == NULL) return 0;
|
if(chainActive.Tip() == NULL) return 0;
|
||||||
|
|
||||||
uint256 hash = 0;
|
uint256 hash = 0;
|
||||||
int64_t aux = 0;
|
uint256 aux = vin.prevout.hash;
|
||||||
|
|
||||||
if(!GetBlockHash(hash, nBlockHeight)) return 0;
|
if(!GetBlockHash(hash, nBlockHeight)) return 0;
|
||||||
|
uint256 hash2 = HashX11(BEGIN(hash), END(hash));
|
||||||
//copy some of the blocks hash into what we'll hash for this calculation
|
uint256 hash3 = HashX11(BEGIN(hash), END(aux));
|
||||||
//this will add some randomness to our results
|
|
||||||
memcpy(&hash+(nBlockHeight%192), &aux, 64);
|
|
||||||
|
|
||||||
uint256 hash2 = HashX11(BEGIN(hash), END(aux));
|
|
||||||
|
|
||||||
// we'll make a 4 dimensional point in space
|
// we'll make a 4 dimensional point in space
|
||||||
// the closest masternode to that point wins
|
// the closest masternode to that point wins
|
||||||
@ -571,11 +567,11 @@ uint256 CMasterNode::CalculateScore(int mod, int64_t nBlockHeight)
|
|||||||
memcpy(&i3, &a3, 1);
|
memcpy(&i3, &a3, 1);
|
||||||
memcpy(&i4, &a4, 1);
|
memcpy(&i4, &a4, 1);
|
||||||
|
|
||||||
//split up our mn hash
|
//split up our mn-hash+aux into 4
|
||||||
uint64_t b1 = vin.prevout.hash.Get64(0);
|
uint64_t b1 = hash3.Get64(0);
|
||||||
uint64_t b2 = vin.prevout.hash.Get64(1);
|
uint64_t b2 = hash3.Get64(1);
|
||||||
uint64_t b3 = vin.prevout.hash.Get64(2);
|
uint64_t b3 = hash3.Get64(2);
|
||||||
uint64_t b4 = vin.prevout.hash.Get64(3);
|
uint64_t b4 = hash3.Get64(3);
|
||||||
|
|
||||||
//move mn hash around
|
//move mn hash around
|
||||||
b1 <<= (i1 % 64);
|
b1 <<= (i1 % 64);
|
||||||
|
Loading…
Reference in New Issue
Block a user