pooler / cpuminer

CPU miner for Litecoin and Bitcoin
https://bitcointalk.org/index.php?topic=55038.0
Other
2.79k stars 1.21k forks source link

Speed up generation of TX buffer in merkle root generation #205

Closed EchterAgo closed 4 years ago

EchterAgo commented 4 years ago

The gbt_work_decode function builds a long string of all the transactions (work->txs) when generating the merkle root. This is done inefficiently using strcat on the beginning of the buffer for each TX. strcat will take more time the longer the string is.

To fix this, we keep track of the end of the end of the string and use strcpy to directly write the current TX there.