Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bytemaster on August 03, 2010, 03:59:25 AM



Title: How do clients enforce the 50 BTC generation rule?
Post by: bytemaster on August 03, 2010, 03:59:25 AM
Suppose one client decided to modify CBlock::GetBlockValue() which hardcodes 50 * COIN as nSubsidy to 1000 * COIN and they "complete a block", what would happen?  What line of code would catch this mis-match?

Shouldn't these kind of settings be in some kind of "config file" instead of distributed all over the code?   



Title: Re: How do clients enforce the 50 BTC generation rule?
Post by: knightmb on August 03, 2010, 04:13:54 AM
Suppose one client decided to modify CBlock::GetBlockValue() which hardcodes 50 * COIN as nSubsidy to 1000 * COIN and they "complete a block", what would happen?  What line of code would catch this mis-match?

Shouldn't these kind of settings be in some kind of "config file" instead of distributed all over the code?   


When I tested that, the other clients would ignore the one that decided to generate 1000 BTC a block for example.


Title: Re: How do clients enforce the 50 BTC generation rule?
Post by: theymos on August 03, 2010, 04:15:03 AM
The block won't be accepted by legitimate users. See ConnectBlock in main.cpp:
Code:
    if (vtx[0].GetValueOut() > GetBlockValue(nFees))
        return false;
(Line 1089)