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.
The
gbt_work_decode
function builds a long string of all the transactions (work->txs
) when generating the merkle root. This is done inefficiently usingstrcat
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.