CloakProject/codename-phoenix

Ensure fees are treated correctly in relation to mining.

Opened this issue · 2 comments

Bitcoin assigns tx fees to miners as part of the mining process. Peercoin (and likely Cloak) seem to treat fees differently. This should be investigated and mirrored (if necessary) in the new codebase.

main.cpp ~ln 1635:

// ppcoin: fees are not collected by miners as in bitcoin
// ppcoin: fees are destroyed to compensate the entire network

Having looked at the code, it looks like fees are handled as per Bitcoin for any tx that is not a coinbase or coinstake tx.

GetProofOfWorkReward takes 'nFees' as an argument and then adds this to the returned subsidy (block reward) amount.

We can see in CreateNewBlock, that fees are indeed included in the block reward for PoW blocks as standard. See ~ln 4497 in main.cpp for the code:

if (pblock->IsProofOfWork())
pblock->vtx[0].vout[0].nValue = GetProofOfWorkReward(pindexPrev->nHeight+1, nFees, pindexPrev->GetBlockHash());