Draft implementation of Ravencoin utils

This commit is contained in:
MoneroOcean
2020-10-31 00:36:22 +00:00
parent d12493f9a9
commit f9c6b2c328

View File

@@ -119,15 +119,14 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
seedhash_buf = sha3.update(seedhash_buf).digest(); seedhash_buf = sha3.update(seedhash_buf).digest();
sha3.reset(); sha3.reset();
} }
const seed_hash = seedhash_buf.toString('hex');
const diff1 = 0x00000000ff000000000000000000000000000000000000000000000000000000; const diff1 = 0x00000000ff000000000000000000000000000000000000000000000000000000;
const difficulty = parseFloat((diff1 / bignum(rpcData.target, 16).toNumber()).toFixed(9)); const difficulty = parseFloat((diff1 / bignum(rpcData.target, 16).toNumber()).toFixed(9));
return { return {
blocktemplate_blob: blob, blocktemplate_blob: blob.toString('hex'),
reserved_offset: offset1 + 4 /* txCoinbase.version */ + 1 /* txCoinbase.marker */ + 1 /* txCoinbase.flag */ + 1 /* txCoinbase.vinLen */, reserved_offset: offset1 + 4 /* txCoinbase.version */ + 1 /* txCoinbase.marker */ + 1 /* txCoinbase.flag */ + 1 /* txCoinbase.vinLen */,
seed_hash: seed_hash, seed_hash: seedhash_buf.toString('hex'),
difficulty: difficulty, difficulty: difficulty,
height: rpcData.height, height: rpcData.height,
rpc: rpcData, rpc: rpcData,