def verify(string): """External method which checks the Bounty as valid under implementation-specific requirements. This can be defined per user. ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ test = depickle(string) try: safeprint("Testing IP address", verbosity=1) if not checkIPAddressValid(test.ip): return False safeprint("Testing Bitcoin address", verbosity=1) # The following is a soft check # A deeper check will be needed in order to assure this is correct if not checkBTCAddressValid(test.btc): return False safeprint("Testing reward and/or signiture validity", verbosity=1) if test.reward not in range(1440, 100000001) or (not test.reward and test.checkSign()): return False safeprint("Testing timeout", verbosity=1) if test.timeout < getUTC(): # check against current UTC return False safeprint("Testing bounty requirements", verbosity=1) if parse(test.data.get('reqs')): return 1 return -1 except: return False
def isValid(self): """Internal method which checks the Bounty as valid in the most minimal version ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ try: safeprint("Testing IP address", verbosity=1) if not checkIPAddressValid(self.ip): return False safeprint("Testing Bitcoin address", verbosity=1) # The following is a soft check # A deeper check will be needed in order to assure this is correct if not checkBTCAddressValid(self.btc): return False safeprint("Testing reward and/or signiture validity", verbosity=1) if self.reward not in range(1440, 100000001) or (not self.reward and self.checkSign()): return False safeprint("Testing timeout", verbosity=1) if self.timeout < getUTC(): # check against current UTC return False safeprint("Testing bounty requirements", verbosity=1) if parse(self.data.get('reqs')): return 1 return -1 except: return False
def verify(string): """External method which checks the Bounty as valid under implementation-specific requirements. This can be defined per user. ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ test = string if type(test) == type(""): test = pickle.loads(string) try: safeprint("Testing IP address", verbosity=1) if not checkIPAddressValid(test.ip): return False safeprint("Testing Bitcoin address", verbosity=1) #The following is a soft check #A deeper check will need to be done in order to assure this is correct if not checkBTCAddressValid(test.btc): return False safeprint("Testing reward and/or signiture validity", verbosity=1) if not test.reward in range(1440, 100000001) or (not test.reward and test.checkSign()): return False safeprint("Testing timeout", verbosity=1) if test.timeout < getUTC(): #check against current UTC return False safeprint("Testing bounty requirements", verbosity=1) if parse(test.data.get('reqs')): return 1 return -1 except: return False
def isValid(self): """Internal method which checks the Bounty as valid under the most minimal version ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ try: safeprint("Testing IP address", verbosity=1) if not checkIPAddressValid(self.ip): return False safeprint("Testing Bitcoin address", verbosity=1) #The following is a soft check #A deeper check will need to be done in order to assure this is correct if not checkBTCAddressValid(self.btc): return False safeprint("Testing reward and/or signiture validity", verbosity=1) if not self.reward in range( 1440, 100000001) or (not self.reward and self.checkSign()): return False safeprint("Testing timeout", verbosity=1) if self.timeout < getUTC(): #check against current UTC return False safeprint("Testing bounty requirements", verbosity=1) if parse(self.data.get('reqs')): return 1 return -1 except: return False
def verify(string): """External method which checks the Bounty as valid under implementation-specific requirements. This can be defined per user. ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ test = None if type(string) == type(Bounty(None,None,None)): test = string else: try: test = pickle.loads(string) except: return False try: safeprint("Testing IP address",verbosity=1) boolean = int(test.ip.split(":")[1]) in range(1024,49152) if len(test.ip.split(":")[0].split(".")) != 4: return False for sect in test.ip.split(":")[0].split("."): boolean = int(sect) in range(0,256) and boolean if not boolean: return False safeprint("Testing Bitcoin address",verbosity=1) address = str(test.btc) #The following is a soft check #A deeper check will need to be done in order to assure this is correct if not checkAddressValid(address): return False safeprint("Testing reward",verbosity=1) reward = int(test.reward) boolean = reward >= 1440 and reward <= 100000000 if reward == 0 or reward is None or test.data.get('cert'): safeprint("Testing signature validity",verbosity=1) boolean = test.checkSign() if boolean is False: return False safeprint("Testing timeout",verbosity=1) if test.timeout < getUTC(): #check against current UTC return False from common.call import parse safeprint("Testing bounty requirements",verbosity=1) if parse(test.data.get('reqs')): return 1 else: return -1 except: return False
def isValid(self): """Internal method which checks the Bounty as valid under the most minimal version ip -- Must be in valid range btc -- Must be in valid namespace reward -- Must be in valid range timeout -- Must be greater than the current time """ try: safeprint("Testing IP address",verbosity=1) boolean = int(self.ip.split(":")[1]) in range(1024,49152) if len(self.ip.split(":")[0].split(".")) != 4: return False for sect in self.ip.split(":")[0].split("."): boolean = int(sect) in range(0,256) and boolean if not boolean: return False safeprint("Testing Bitcoin address",verbosity=1) address = str(self.btc) #The following is a soft check #A deeper check will need to be done in order to assure this is correct if not checkAddressValid(address): return False safeprint("Testing reward",verbosity=1) reward = int(self.reward) boolean = reward >= 1440 and reward <= 100000000 if reward == 0 or reward is None or self.data.get('cert'): safeprint("Testing signature validity",verbosity=1) boolean = self.checkSign() if boolean is False: return False safeprint("Testing timeout",verbosity=1) if self.timeout < getUTC(): #check against current UTC return False from common.call import parse safeprint("Testing bounty requirements",verbosity=1) if parse(self.data.get('reqs')): return 1 else: return -1 except: return False