How does a miner’s pubkey get passed into miner.cpp? I understand that a miner using an application like pooler’s cpuminer can set a Coinbase-txn address where new coins that are generated to. I’m trying to override this setting in the code of the core client for an academic project to demonstrate bitcoin’s consensus mechanism. When I try to set a fixed address in the core client, the miner is still being paid out to the address they set rather than the hardcoded one in the miner.cpp file

How does the address get sent for a miner’s Coinbase transaction payout? Having some insight into where the logic is would allow me to further try and troubleshoot my project.

Thank you
Bitcoin Core does not set the payout address. It can only do that when you use the internal miner (i.e. use the generatetoaddress command, but only on regtest). Otherwise, external mining software sets the address. This is because Bitcoin Core does not just send a complete block that the mining software just works on.

Rather, those mining software use the getblocktemplate RPC which returns a block template. This template does not include a coinbase transaction. It just includes information necessary to construct the coinbase (such as amounts) as well as the transaction data to include in the block. But it is not a block itself and the external miner still has to construct their own coinbase transaction and block given the information in the block template.

So Bitcoin Core cannot force an external mining software to use a particular output script in the coinbase transaction. You have to configure your mining software to do that.