def checkKeyIn(): keyNum = stdscr.getch() if keyNum == -1: return False else: key = chr(keyNum) if key in ("d", "D"): deposit() elif key in ("q", "Q"): sys.exit() elif key in ("b", "B"): showValue("balance") elif key in ("p", "P"): party(2) elif key in ("w", "W"): withdraw() elif key in ("h", "H"): showHistory() elif key in ("r", "R"): res = peers.refreshPeers() printMsg(res) time.sleep(2) elif key in ("l", "L"): global LEDGRID LEDGRID = not LEDGRID
numTx = mempoolInfo['size'] memBytes = mempoolInfo['bytes'] # load recent block info from file created by blocks.py if not os.path.isfile(blockFile): printMsg("No block history file, loading best block...", COLOR_RED) bestHash = rpc_connection.getbestblockhash() os.system("python " + rootdir + "/block.py " + str(bestHash)) f = open(blockFile, 'r') d = f.read() blockData = json.loads(d) f.close() # load peers info from file if not os.path.isfile(peerFile): peers.refreshPeers() p = open(peerFile, 'r') pd = p.read() peerData = json.loads(pd) p.close() # check for a new Tx file, load, then delete it if os.path.isfile(txFile): t = open(txFile, 'r') td = t.read() t.close() os.remove(txFile) if td: txData = json.loads(td) if txData: newTx(txData)
try: blockData = json.loads(d) except ValueError: eout = open("~/pybits/ERR.txt", "w") eout.write(d) eout.close() cleanup() print "VALUE ERROR" print d exit() f.close() # load peers info from file if not os.path.isfile(peerFile): peers.refreshPeers() p = open(peerFile,'r') pd = p.read() peerData = json.loads(pd) p.close() # check for a new Tx file, load, then delete it if os.path.isfile(txFile): t = open(txFile,'r') td = t.read() t.close() os.remove(txFile) if td: txData = json.loads(td) if txData: newTx(txData)