protected override byte[] SerializeHeader(uint nTime, string nonce) { // BTG requires the blockheight to be encoded in the first 4 bytes of the hashReserved field var heightAndReserved = new byte[32]; BitConverter.TryWriteBytes(heightAndReserved, BlockTemplate.Height); var blockHeader = new EquihashBlockHeader { Version = (int)BlockTemplate.Version, Bits = new Target(Encoders.Hex.DecodeData(BlockTemplate.Bits)), HashPrevBlock = uint256.Parse(BlockTemplate.PreviousBlockhash), HashMerkleRoot = new uint256(merkleRoot), HashReserved = heightAndReserved, NTime = nTime, Nonce = nonce }; return(blockHeader.ToBytes()); }
protected override byte[] SerializeHeader(uint nTime, string nonce) { var blockHeader = new EquihashBlockHeader { Version = (int)BlockTemplate.Version, Bits = new Target(Encoders.Hex.DecodeData(BlockTemplate.Bits)), HashPrevBlock = uint256.Parse(BlockTemplate.PreviousBlockhash), HashMerkleRoot = new uint256(merkleRoot), NTime = nTime, Nonce = nonce }; if (isSaplingActive && !string.IsNullOrEmpty(BlockTemplate.FinalSaplingRootHash)) { blockHeader.HashReserved = BlockTemplate.FinalSaplingRootHash.HexToReverseByteArray(); } if (!string.IsNullOrEmpty(BlockTemplate.Solution)) { blockHeader.SolutionIn = BlockTemplate.Solution.HexToReverseByteArray().ToHexString(); } return(blockHeader.ToBytes()); }