-
Notifications
You must be signed in to change notification settings - Fork 697
SHA256 Mining On Testnet #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
SHA256 Mining On Testnet #1259
Conversation
@@ -423,7 +423,7 @@ class CDiskBlockIndex : public CBlockIndex | |||
READWRITE(hashMerkleRoot); | |||
READWRITE(nTime); | |||
READWRITE(nBits); | |||
if (nTime < nKAWPOWActivationTime) { | |||
if (nTime < nKAWPOWActivationTime || (bNetwork.fOnTestnet && !fKawpowAsMiningAlgo && nTime >= nSHA256KawpowSwitchActivationTime)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extract this logic into a helper method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's reduce code duplication and implement a helper method for
bNetwork.fOnTestnet && !fKawpowAsMiningAlgo && nTime >= nSHA256KawpowSwitchActivationTime
if (nTime >= nTimeToUse) { | ||
return HashX16RV2(BEGIN(nVersion), END(nNonce), hashPrevBlock); | ||
} | ||
|
||
return HashX16R(BEGIN(nVersion), END(nNonce), hashPrevBlock); | ||
} else { | ||
return KAWPOWHash_OnlyMix(*this); | ||
// Kawpow activation time has passed, now check if we are on the testnet | ||
if (bNetwork.fOnTestnet && !fKawpowAsMiningAlgo && nTime >= nSHA256KawpowSwitchActivationTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extract this logic into a helper method.
if (nTime >= nTimeToUse) { | ||
return HashX16RV2(BEGIN(nVersion), END(nNonce), hashPrevBlock); | ||
} | ||
|
||
return HashX16R(BEGIN(nVersion), END(nNonce), hashPrevBlock); | ||
} else { | ||
return KAWPOWHash(*this, mix_hash); | ||
// Kawpow activation time has passed, now check if we are on the testnet | ||
if (bNetwork.fOnTestnet && !fKawpowAsMiningAlgo && nTime >= nSHA256KawpowSwitchActivationTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extract this logic into a helper method.
@@ -64,7 +66,8 @@ class CBlockHeader | |||
READWRITE(hashMerkleRoot); | |||
READWRITE(nTime); | |||
READWRITE(nBits); | |||
if (nTime < nKAWPOWActivationTime) { | |||
//If the time is before the kawpow activation time OR (on testnet, kawpow is not set as the mining algo, and past the sha256 switch activation time) | |||
if (nTime < nKAWPOWActivationTime || (bNetwork.fOnTestnet && !fKawpowAsMiningAlgo && nTime >= nSHA256KawpowSwitchActivationTime)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extract this logic into a helper method.
@rumplin I still need to test to ensure this will work, @hans-schmidt was telling me at some point that this would not work as I had intended, however I do not know the depth in which he had looked at the code. The ultimate determination is that two separate testnets would be needed, one for Kawpow, one for SHA256, and could be expanded upon from there ultimately with more nets. However, it would be nice to see if this code would actually work, I was hopefully that the algo switch functionality I was trying to implement in the node would be enough to trigger it, but when it comes down to the block array, verification, etc., needs to be double checked/tested/fixed if possible, as having an algo switch on the node would be nice! Feel free to reach out to collab! |
Well RVN is a fork of BTC, so it should work in theory :) |
@rumplin as I get more time now that I have you diving in on it too, I will try and come up with the final version so you have this feature. I assume you are building a new fork coin? |
I was casually looking at the open pull requests. Not doing any forking for coins. |
Gotcha! Was just curious; yeah man, I'm hoping that I can iron this one out, and push it over to EVR, my own fork, etc., but figured start with RVN! |
Ping me when ASICs are needed for testnet. I'm down to throw a couple rigs on it. |
Saw how this was done on EVR and figured I would take a shot at it!