Hi everybody,

I am working on the btcd port for peercoin.

Blockchain sync is stuck on block 7661 because the corresponding proof of stake hash is not considered valid.

All previous PoS blocks are passing all validation steps perfectly fine, so we are probably on some edge case.

I would like to verify that I am correctly building the corresponding array of bytes to be hashed to exclude that possibility.

Here are the values used for building the byte array (check code links below):

nBits=470557660

nTimeBlockFrom=1345496436

nTxPrevOffset=195

txPrev.nTime=1345496397

prevout.n=1

nTimeTx=1348905506

Here is what I obtain after concatenating the values above:

[220 35 12 28 116 165 50 80 195 0 0 0 77 165 50 80 1 0 0 0 34 170 102 80] (decimal form)

[DC 23 0C 1C 74 A5 32 50 C3 00 00 00 4D A5 32 50 01 00 00 00 22 AA 66 50] (hexa form)

Which gives me after double sha256 hashing:

849055dc415056668ce1678f7e3472e16bddd4f29d240c84329d0adabfab7096 (invalid)

Instead of:

00000208ca3c0d2a2ee562b10e5b3b89630fe0eb03b2311fedb9b411af751883 (correct)

Two possibilities: either the values used for calculating the hash are erroneous, either the Go hash method has a bug.

I would prefer the first possibility Can someone verifiy that these are the right values for block #7661 ?

Any help will be really greatly appreciated.

Thanx in advance.

Original peercoin core code: https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L313

Our ppcd code: https://github.com/mably/btcchain/blob/mably/kernel.go#L406