Example #1
0
def isForAddr(addrHash, txOut):
   if PAY_TO_PUBLIC_KEY == txOut.txOutType:
      # skip the push command at the beginning and OP_CHECKSIG at the end
      result = hash160(txOut.script[1:-1]) == addrHash
   elif PAY_TO_PUBKEY_HASH == txOut.txOutType:
      # skip OP_DUP, OP_HASH160, and push command (0x14) to start and OP_EQUALVERIFY and OP_CHECKSIG at the end
      result = txOut.script[3:-2] == addrHash
   else:
      result = False
   return result
Example #2
0
def recordHistory(blkList, testHash):
   result = []
   for blk in blkList:
      for tx in blk.txList:
         for txOut in tx.txOutList:
            if PAY_TO_PUBLIC_KEY == txOut.txOutType:
               # skip the push command at the beginning and OP_CHECKSIG at the end
               addr = txOut.script[1:-1]
               if binary_to_hex(hash160(addr)) == testHash:
                  result.append(txOut)
                  print blk.blkNum, coin2str(txOut.value, 4)
 def testGetreceivedbyaddress(self):
    a160 = hash160(self.wallet.getNextUnusedAddress().binPublicKey65.toBinStr())
    testAddr = hash160_to_addrStr(a160)
    result = self.jsonServer.jsonrpc_getreceivedbyaddress(testAddr)
    self.assertEqual(result, 0)
Example #4
0
 def testGetreceivedbyaddress(self):
     a160 = hash160(
         self.wallet.getNextUnusedAddress().binPublicKey65.toBinStr())
     testAddr = hash160_to_addrStr(a160)
     result = self.jsonServer.jsonrpc_getreceivedbyaddress(testAddr)
     self.assertEqual(result, 0)