Esempio n. 1
0
	def __init__( self, database, poolname ):
		self.db = database
		self.poolname = poolname
		self.config = self.db.getPool( self.poolname )
		self.address = self.config['address']
		self.port = self.config['port']
		self.username = self.config['username']
		self.password = self.config['password']
		self.timeout = int( self.config['timeout'] )
		
		self.authorizationStr = base64.b64encode(self.username + ":" + self.password).replace('\n','')	
		self.id = 0
		
		self.target = ""
		
		self.logger = logging.getLogger( "PoolManager.Pool.GetWork" )
		
		try:
			self.target = self.config['target']
		except:
			self.target = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"
			
		self.targetInt = sha2int( sha2x( self.target ) )
		
		self.header = { "X-Mining-Extensions": "longpoll", "Authorization": "Basic " + self.authorizationStr, "User-Agent": "polcbm", "Content-Type": "text/plain" }
		self.url = "http://" + self.address + ":" + str(self.port)
		
		#Pool of http objects which will hopefully fix the memory issue.
		self.httpPool = ResourcePool( self.makeHttp )
Esempio n. 2
0
	def checkWorkValidity( self, minerName, work ):
		share = self.getShare( minerName, work )
		
		if share['data'][:4] != b'\1\0\0\0':
			{ "share": share, "status": False }
			
		hash = sha2x( share['data'] )
		
		if hash[28:] != b'\0\0\0\0':
			return { "share": share, "status": False }
			
		hashInt = sha2int( hash )
		
		if hashInt >= self.targetInt:
			return { "share": share, "status": False }
			
		return { "share": share, "status": True }
Esempio n. 3
0
    def checkWorkValidity(self, minerName, work):
        share = self.getShare(minerName, work)

        if share['data'][:4] != b'\1\0\0\0':
            {"share": share, "status": False}

        hash = sha2x(share['data'])

        if hash[28:] != b'\0\0\0\0':
            return {"share": share, "status": False}

        hashInt = sha2int(hash)

        if hashInt >= self.targetInt:
            return {"share": share, "status": False}

        return {"share": share, "status": True}
Esempio n. 4
0
    def __init__(self, database, poolname):
        self.db = database
        self.poolname = poolname
        self.config = self.db.getPool(self.poolname)
        self.address = self.config['address']
        self.port = self.config['port']
        self.username = self.config['username']
        self.password = self.config['password']
        self.timeout = int(self.config['timeout'])

        self.authorizationStr = base64.b64encode(self.username + ":" +
                                                 self.password).replace(
                                                     '\n', '')
        self.id = 0

        self.target = ""

        self.logger = logging.getLogger("PoolManager.Pool.GetWork")

        try:
            self.target = self.config['target']
        except:
            self.target = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"

        self.targetInt = sha2int(sha2x(self.target))

        self.header = {
            "X-Mining-Extensions": "longpoll",
            "Authorization": "Basic " + self.authorizationStr,
            "User-Agent": "polcbm",
            "Content-Type": "text/plain"
        }
        self.url = "http://" + self.address + ":" + str(self.port)

        #Pool of http objects which will hopefully fix the memory issue.
        self.httpPool = ResourcePool(self.makeHttp)