Skip to content

Commit 222e0b1

Browse files
author
limxdev
committed
Preparation Algoswitch
1 parent e720d25 commit 222e0b1

2 files changed

Lines changed: 21 additions & 74 deletions

File tree

src/pow.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,21 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
185185
{
186186
return DUAL_KGW3(pindexLast, pblock, params);
187187
}
188-
/*
189-
// Megacoin Miningalgo switch
190-
// 1571832146 Wednesday, 23. October 2019 12:02:26
188+
189+
// Bitcore Miningalgo switch
191190
// please check also block.cpp:L62
192-
if(pblock->GetBlockTime() >= HASH_FORK_TIME_1 && pindexLast->GetBlockTime() <= HASH_FORK_TIME_1 + 86400) // We have a timerange from 24 hours to find a new block
191+
// We have a timerange from 24 hours to find a new block
192+
if(pblock->GetBlockTime() >= HASH_FORK_TIME_1 && pindexLast->GetBlockTime() <= HASH_FORK_TIME_1 + 86400)
193193
{
194194
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*24)
195195
{
196-
//consensus.nPowTargetSpacing = 2.5 * 60; // Megacoin
197-
//This should be one hour then is this function possible
198-
LogPrintf("Megacoin Hashalgoupdate MEGA BTX!!! \n");
199-
return nProofOfWorkLimit;
196+
//consensus.nPowTargetSpacing = 2.5 * 60; // Megacoin
197+
//This should be one hour then is this function possible
198+
LogPrintf("Megacoin Hashalgoupdate MEGA BTX!!! \n");
199+
return nProofOfWorkLimit;
200200
}
201201
}
202-
*/
202+
203203

204204

205205
if (pindexLast->nHeight+1 <= fork2)

src/primitives/block.cpp

Lines changed: 12 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -33,79 +33,26 @@ uint256 CBlockHeader::GetPoWHash() const
3333
uint256 powHash = uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
3434

3535
//BitCore
36-
37-
if(GetBlockTime() >= 1493124696) //Human time (GMT): Tue, 25 Apr 2017 12:51:36 GMT
38-
{
36+
if(GetBlockTime() >= HASH_FORK_TIME_1) //Wednesday, 23. October 2019 12:02:26
37+
{
38+
return Mega_Btx(BEGIN(nVersion), END(nNonce), GetBlockTime());
39+
}
40+
else
41+
{
42+
if(GetBlockTime() >= 1493124696) //Human time (GMT): Tue, 25 Apr 2017 12:51:36 GMT
43+
{
3944
return HashTimeTravel(BEGIN(nVersion), END(nNonce), GetBlockTime()); // BitCore TimeTravel
40-
}
41-
else
42-
{
45+
}
46+
else
47+
{
4348

4449
scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(powHash)); // BitCore Scrypt
4550
return powHash;
46-
}
47-
return powHash;
48-
49-
//Brainstormingpart
50-
/*
51-
switch (nVersion & ALGO_VERSION_MASK)
52-
{
53-
case ALGO_SHA256D: powHash = GetHash(); break;
54-
case ALGO_SCRYPT: scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(powHash)); break;
55-
case ALGO_NIST5: powHash = NIST5(BEGIN(nVersion), END(nNonce)); break;
56-
case ALGO_LYRA2Z: lyra2z_hash(BEGIN(nVersion), BEGIN(powHash)); break;
57-
case ALGO_X11: powHash = HashX11(BEGIN(nVersion), END(nNonce)); break;
58-
case ALGO_X16R: powHash = HashX16R(BEGIN(nVersion), END(nNonce), hashPrevBlock); break;
59-
default: break; // FXTC TODO: we should not be here
51+
}
6052
}
61-
6253
return powHash;
63-
*/
64-
/*
65-
// Megacoin
66-
67-
if(GetBlockTime() >= 1493124696) { //Human time (GMT): Tue, 25 Apr 2017 12:51:36 GMT
68-
return HashTimeTravel(BEGIN(nVersion), END(nNonce), GetBlockTime()); // MegaCoin TimeTravel
69-
}
70-
else
71-
{
72-
73-
uint256 thash;
74-
// please check also pow.cpp:L414
75-
//10/21/2019 @ 12:00am (UTC)
76-
if(GetBlockTime() >= HASH_FORK_TIME_1) //Wednesday, 23. October 2019 12:02:26
77-
{
78-
//thash = HashX16R(BEGIN(nVersion), END(nNonce), hashPrevBlock);
79-
scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(thash));
80-
} //10/21/2019 @ 12:00am (UTC)
81-
else
82-
{
83-
scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(thash));
84-
return thash;
85-
}
86-
return thash;
87-
*/
8854
}
8955

90-
91-
/*
92-
unsigned int CBlockHeader::GetAlgoEfficiency(int nBlockHeight) const
93-
{
94-
switch (nVersion & ALGO_VERSION_MASK)
95-
{
96-
case ALGO_SHA256D: return 1;
97-
case ALGO_SCRYPT: return 13747;
98-
case ALGO_NIST5: return 2631;
99-
case ALGO_LYRA2Z: return 2014035;
100-
case ALGO_X11: return 477;
101-
case ALGO_X16R: return 263100;
102-
default: return 1; // FXTC TODO: we should not be here
103-
}
104-
105-
return 1; // FXTC TODO: we should not be here
106-
}
107-
*/
108-
10956
std::string CBlock::ToString() const
11057
{
11158
std::stringstream s;

0 commit comments

Comments
 (0)