Author

Topic: Can you review this code and tell me if it would work? (Read 615 times)

sr. member
Activity: 378
Merit: 250
It worked  Grin
sr. member
Activity: 378
Merit: 250
all your nSubsidy should finish in coin.

e.g.

if (nSubsidy > 100) nSubsidy = 100;


if (nSubsidy > 100) nSubsidy = 100 * COIN;


The rest look broken also with the double ifs and other things.


what do you mean?
it wont work?
it hard forks at block 550 and now is block 467
i think it will work. can you tell me what you mean about the ifs being broken? to me it looks they are not broken, why do you think its broken? can you give me an example?
thank you
sorry if i am asking alot of questions. this is the first time i make a coin
legendary
Activity: 1008
Merit: 1022
all your nSubsidy should finish in coin.

e.g.

if (nSubsidy > 100) nSubsidy = 100;


if (nSubsidy > 100) nSubsidy = 100 * COIN;


The rest look broken also with the double ifs and other things.

sr. member
Activity: 378
Merit: 250
sr. member
Activity: 378
Merit: 250
right now the block reward for the coin i launched is :
but it does not work the way i expected it to.
Code:
// block reward between 500 and 20 depending on the difficulty.
int64 nSubsidy = 0;
    if(dDiff > 250) { // GPU/ASIC difficulty calc 2000000/(((x+1900)/10)^2)
        nSubsidy = (2000000.0 / (pow((dDiff+1900.0)/10.0,2.0)));
        if (nSubsidy > 100) nSubsidy = 100;
        if (nSubsidy < 20) nSubsidy = 20;
    } else { // CPU mining calc
     nSubsidy = (11111.0 / (pow((dDiff+51.0)/6.0,2.0)));
        if (nSubsidy > 500) nSubsidy = 500;
        if (nSubsidy < 200) nSubsidy = 200;
    }

if i change that part of the code to this:
would it work? like would it hard fork at block 550?
i mean can you look through the changes and the if and else statments and the "{" and "}" to see if it would work?
thank you.
Code:
int64 nSubsidy = 0;
if(nHeight >= 550) {

if(dDiff > 75) { // GPU/ASIC difficulty calc
// 2222222/(((x+2600)/9)^2)
nSubsidy = (2222222.0 / (pow((dDiff+2600.0)/9.0,2.0)));
if (nSubsidy > 25) nSubsidy = 25;
if (nSubsidy < 5) nSubsidy = 5;
} else { // CPU mining calc
nSubsidy = (11111.0 / (pow((dDiff+51.0)/6.0,2.0)));
if (nSubsidy > 500) nSubsidy = 500;
if (nSubsidy < 25) nSubsidy = 25;
}

} else {
if(dDiff > 250) { // GPU/ASIC difficulty calc 2000000/(((x+1900)/10)^2)
nSubsidy = (2000000.0 / (pow((dDiff+1900.0)/10.0,2.0)));
if (nSubsidy > 100) nSubsidy = 100;
if (nSubsidy < 20) nSubsidy = 20;
} else { // CPU mining calc
nSubsidy = (11111.0 / (pow((dDiff+51.0)/6.0,2.0)));
if (nSubsidy > 500) nSubsidy = 500;
if (nSubsidy < 200) nSubsidy = 200;
}
}
Jump to: