Post
Topic
Board Announcements (Altcoins)
Re: GRouPcoin
by
hendo
on 21/10/2013, 06:19:03 UTC
Actually, KrLos, if you read THIS VERY PAGE, you'll see that there is now an updated version (though experimental) with a more recent bitcoind/bitcoin-qt base.
And it seems to work well, though I'd appreciate some feedback  Smiley
After all I could move on to other merge mined coins to update their clients.

Had floating point exceptions when downloading full blockchain.  Can't be bothered forking in github but here's a patch:
Code:
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1115,8 +1115,8 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl
     if (pindexLast == NULL)
         return nProofOfWorkLimit;

-    if (pindexLast->nHeight < 9500)
-        nTargetTimespan *= 14; // two weeks
+    // prior to block 9500 2 weeks.. daily after
+    nTargetTimespan = (pindexLast->nHeight < 9500) ? 1209600 : 86400;
     int64 nInterval = nTargetTimespan / nTargetSpacing;

Only quickly tested daemon on ubuntu 12.04 x64 but seems to work.
Well it should be equal, there's no floating point math used.
Do you have any logs?

Original version increases nTargetTimespan for every GetNextWorkRequired with block < 9500.  
This is used in some modulo operations later which I'm guessing eventually result in a div 0 after it overflows.
Also, couldn't see where it would be set back to 1 day on block 9500, without restart?

For any block earlier than 9500 nTargetTimespan is 14 days, 1 day thereafter.
It's exactly what my code does, the same code is used in old client.
Code:
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast)
{
    const int nSmoothBlock = 9500;
    const int64 nTargetSpacing = 10 * 60;
    int64 nTargetTimespan = 24 * 60 * 60; // one day

    if (pindexLast->nHeight < nSmoothBlock)
        nTargetTimespan *= 14; // two weeks
    int64 nInterval = nTargetTimespan / nTargetSpacing;

Sorry for flogging a dead horse but not quite...   

In the new fork, nTargetTimespan is global (i.e. will be multiplied by 14 every call, and eventually overflow).  If the above snippet is original client, it is local and so will behave as expected.
Am guessing it is global now as was referenced in some other function/s, otherwise making it local would have been the better fix. 
You might want to check if mutating the value on the fly will affect any other usages of it too.

I'm assuming we are both looking at the same code, branch i0coin-0.8.x was default in git?  If not my humble apologies.