moopless / stratum-mining-litecoin

This fork is no longer maintained. Please use https://github.com/ahmedbodi/stratum-mining
Other
38 stars 35 forks source link

Stratum Block Solution not following specs #60

Open Neozonz opened 10 years ago

Neozonz commented 10 years ago

The solution block isn't following the correct specifications for scrypt/block solutions

See: https://litecoin.info/Scrypt

TheSerapher commented 10 years ago

Are you sure? The scrypt solution returned when disabling blockhash solution worked fine against my PHP implementation of scrypt.

Neozonz commented 10 years ago

https://github.com/moopless/stratum-mining-litecoin/blob/master/lib/template_registry.py#L226-L230

#Convert each header element big-endian to little-endian and convert to scrypt
        hash_bin = ltc_scrypt.getPoWHash(''.join([ header_bin[i*4:i*4+4][::-1] for i in range(0, 20) ]))

#Convert to INT
        hash_int = util.uint256_from_str(hash_bin)

#Convert to HEX
        scrypt_hash_hex = "%064x" % hash_int

#Convert header to HEX
        header_hex = binascii.hexlify(header_bin)
        header_hex = header_hex+"000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"

#Submit Scrypt Block Hash
return (header_hex, scrypt_hash_hex, share_diff, on_submit)

Looking at wiki, it should be:

Currently:

Unless the wiki is wrong or I'm misunderstanding something...