I am trying to understand the monero code and was unsure how the code decides which address to the block reward to and how it is done. I have been able to follow the proccess up until we decide how much the block reward is but after that I havent been able to follow the code to see how it actually creates the transaction and sends it.
In the miner code, there is a
request_block_template function, which requests a new block template to the daemon using the miner's address.
If and when the miner finds a block, she will create it from the block template that contains her address. If the block is accepted by the network, her address will be credited with the block reward.