Is the difficulty target always truncated for practical purposes? The current value of bits in the block header is: 18034379. In target form, this is equal to:

0x0000000000000000034379000000000000000000000000000000000000000000


However, if you calculate the target using the difficulty:

target = maxtarget / difficulty
target = 0x00000000ffff0000000000000000000000000000000000000000000000000000 / 336899932795.8077
target = 0x0000000000000000034379000000004000000000000000000000000000000000


As you can just about see, this calculated value is more accurate than the  truncated target you get using bits.

My question is:


When mining, is the truncated target used (the one you get from bits), as opposed to the more accurate target you get by dividing the maxtarget by the difficulty?
Therefore, for all practical purposes, you should truncate the target you get when you divide the maxtarget by the difficulty?
When mining, is the truncated target used (the one you get from bits), as opposed to the more accurate target you get by dividing the maxtarget by the difficulty?


Yes. The bits value actually stored in headers is what matters, as this allows validation of standalone headers without context. Due to headers-first sync this is no longer strictly needed, but there is no reason to change the rules now.


  Therefore, for all practical purposes, you should truncate the target you get when you divide the maxtarget by the difficulty?


Yes.

There is at most a 0.0015% difference between the two, though (1 in 2**16).