Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on July 22, 2019, 07:08:18 AM



Title: In mining are the rest of target bytes 0 or 255?
Post by: Coding Enthusiast on July 22, 2019, 07:08:18 AM
If nBits is 0x1b0404cb the target according to wiki is calculated as
Code:
0x00000000000404CB000000000000000000000000000000000000000000000000

so does this mean if the block hash was the following it would be rejected?
Code:
0x00000000000404CB000000000000000000000000000000000000000000000001

or do we set the remaining bytes in target to 0xff and then compare it with hash result? (Which means the above block hash could be accepted)
Code:
0x00000000000404CBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF


Title: Re: In mining are the rest of target bytes 0 or 255?
Post by: tromp on July 22, 2019, 07:18:56 AM
As shown in

https://github.com/bitcoin/bitcoin/blob/d0f81a96d9c158a9226dc946bdd61d48c4d42959/src/arith_uint256.cpp#L213-L214

the rest of the bits remain 0. So that one is indeed rejected.