Skip to content

Commit

Permalink
Refactor daemon port and cookie directory
Browse files Browse the repository at this point in the history
  • Loading branch information
romanz committed Aug 14, 2018
1 parent 123e0cf commit 56af617
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
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
Expand Down

0 comments on commit 56af617

Please sign in to comment.