Browse Source

Refactor daemon port and cookie directory

refactor-mempool
Roman Zeyde 7 years ago
parent
commit
56af6170dd
No known key found for this signature in database GPG Key ID: 87CAE5FA46917CBB
  1. 6
      tools/mempool.py

6
tools/mempool.py

@ -8,10 +8,10 @@ import numpy as np
import matplotlib.pyplot as plt
class Daemon:
def __init__(self):
self.sock = socket.create_connection(('localhost', 8332))
def __init__(self, port=8332, cookie_dir='~/.bitcoin'):
self.sock = socket.create_connection(('localhost', port))
self.fd = self.sock.makefile()
path = os.path.expanduser('~/.bitcoin/.cookie')
path = os.path.join(os.path.expanduser(cookie_dir), '.cookie')
cookie = binascii.b2a_base64(open(path, 'rb').read())
self.cookie = cookie.decode('ascii').strip()
self.index = 0

Loading…
Cancel
Save