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 """ from common.bounty import verify verify(string)
if not (sys.version_info[0] < 3 and sys.platform == "win32"): safeprint("Test listener begin") v = Value('b',True) q = Queue() a = Process(target=waitForty,args=(v,q)) a.start() listen(44566,False,q,v,False) from common.call import call safeprint(call("random","random")) safeprint(call("sys","platform",index=0)) safeprint(bounty.Bounty(('8.8.8.8',8888),"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",10290) <= bounty.getBounty(False,2)) safeprint(bounty.Bounty(('8.8.8.8',8888),"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",10290) >= bounty.getBounty(False,2)) safeprint(bounty.Bounty(('8.8.8.8',8888),"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",10290) != bounty.getBounty(False,2)) import rsa pub, priv = rsa.newkeys(1024) testSig = bounty.Bounty(('8.8.8.8',8888),"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",0,keypair=priv,ident="ABCDEFGHIJKLMNOP",dataDict={'author':"QRSTUVWXYZ"}) safeprint("Test internal signature verification when signed") safeprint(testSig.isValid()) safeprint("Test external signature verification when signed") safeprint(bounty.verify(testSig)) safeprint("Test external signature verification when signed and fed from pickle") safeprint(bounty.verify(pickle.dumps(testSig,0))) safeprint("Testing addBounties") bounty.addValidBounty(testSig) testSig.sign(3) #Test sign failure testSig.data['key'] = (1,1) testSig.checkSign() safeprint(bounty.addBounties([bounty.Bounty(('8.8.8.8',8888),"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",10290),bounty.Bounty('8.8.8.8:8888',"1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg",0)])) safeprint("This should exit now") exit(0)
10290) >= bounty.getBounty(False, 2)) safeprint( bounty.Bounty(('8.8.8.8', 8888), "1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg", 10290) != bounty.getBounty(False, 2)) import rsa pub, priv = rsa.newkeys(1024) testSig = bounty.Bounty(('8.8.8.8', 8888), "1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg", 0, keypair=priv, ident="ABCDEFGHIJKLMNOP", dataDict={'author': "QRSTUVWXYZ"}) safeprint("Test internal signature verification when signed") safeprint(testSig.isValid()) safeprint("Test external signature verification when signed") safeprint(bounty.verify(testSig)) safeprint( "Test external signature verification when signed and fed from pickle") safeprint(bounty.verify(pickle.dumps(testSig, 0))) safeprint("Testing addBounties") bounty.addValidBounty(testSig) testSig.sign(3) #Test sign failure testSig.data['key'] = (1, 1) testSig.checkSign() safeprint( bounty.addBounties([ bounty.Bounty(('8.8.8.8', 8888), "1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg", 10290), bounty.Bounty('8.8.8.8:8888', "1EgGfDetymjMzcQ1AEhHjHEyXHjnEavwgg", 0) ]))