Alot of these altcoins have the GetBlockSubsidy method in regards to mining/rewards. In regards to rewards would be calculated as follows:
CAmount nSubsidy = 50 * COIN;
What stops someone from changing the above line of code to something ridiculous ie:
CAmount nSubsidy = 50000000 * COIN;
Wouldnt that cause the next block that is mined (against the above compiled line of code) to reward a ridiculious amount of coins?
Thanks
Yes anyone can change that but if they change that then the protocol is completely different and its a completely different coin. It would basically fork all the main chain. So you can compile your own Bitcoin, change the next block reward to something crazy and mine a block, however what will happen is that you would only get the large amount of coins on your own chain which nobody else is using. The main chain the reward given to you would be the original 50 BTC or so.
Bitcoins and all cryptos are open source, you can easily modify the code however if nobody runs YOUR code then there is not much that can be done really. So you don't have to worry about someone changing the code and giving themselves an unlimited amount of coins when nobody would be running that particular client.