How was the new target for block 32256 calculated? I'm trying to calculate the new target for Block 32256, but I'm not getting the expected result. Here's what I did:


Timestamp of the previous block (32255) = 1262152739
Timestamp of block (32255 - 2015 = 30240) = 1261130161
Diff: 1262152739 - 1261130161 = 1022578
Note that there is no limit adjustment (1/2 weeks &lt; 1022578 &lt; 8 weeks)
Current target (0x1d00ffff) = 26959535291011309493156476344723991336010898738574164086137773096960
Multiply the difference with current target
=  1022578 * 26959535291011309493156476344723991336010898738574164086137773096960
= 27568227678811762838892963267635169612395352810293691562874591737943162880
Divide by two weeks
27568227678811762838892963267635169612395352810293691562874591737943162880 / 1209600
= 22791193517536179595645637622052884930882401463536451358196587084939


From what I understand, this should be the new target for block 32256 and the following 2015 blocks. However, it isn't - the correct new target as given in blockexplorer is:

22791060871177364286867400663010583169263383106957897897309909286912

As you can see, my result was kind of in the ballpark, but not correct. What am I missing here?

Related questions:


How is difficulty calculated?
How to calculate new “bits” value?
The actual target (and thus difficulty) is determined by its compact 32-bit encoding.

After the computation you did above, you should round it to the nearest compactly-representable target (24-bit accuracy, multiple of 256). That is the target encoded inside blocks, and the one that matters.