Skip to content

Commit

Permalink
fix windows support and remove debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pdxwebdev committed Oct 10, 2018
1 parent e0ed4d2 commit a71bb17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions node.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class ChatNamespace(BaseNamespace):
def on_error(self, event, *args):
print 'error'

def node(nonces=None):
def node(nonces=None, config=None):
Config.from_dict(json.loads(config))
Peers.init()
latest_block_index = Value('i', 0)
my_peer = Config.peer_host + ":" + str(Config.peer_port)
Config.max_duration = 300000
Expand All @@ -70,7 +72,7 @@ def node(nonces=None):

dup_test = Mongo.db.consensus.find({'peer': 'me', 'index': latest_block_index.value, 'block.version': BU.get_version_for_height(latest_block_index.value + 1)}).sort([('index', -1)])
if dup_test.count():
print 'returning', latest_block_index.value + 1, BU.get_version_for_height(latest_block_index.value + 1)
#print 'returning', latest_block_index.value + 1, BU.get_version_for_height(latest_block_index.value + 1)
return

transactions = Mongo.db.miner_transactions.find()
Expand Down
9 changes: 5 additions & 4 deletions p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import subprocess
import os
import endpoints
import multiprocessing
from sys import exit
from multiprocessing import Process, Value, Array, Pool
from socketIO_client import SocketIO, BaseNamespace
Expand Down Expand Up @@ -395,6 +396,7 @@ def retrace(self, block, peer):
return

if __name__ == '__main__':
multiprocessing.freeze_support()
import argparse
import os.path
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -448,7 +450,6 @@ def retrace(self, block, peer):
elif args.mode == 'send':
send(args.to, float(args.value))
elif args.mode == 'mine':
import multiprocessing
print Config.to_json()
def nonce_generator():
Mongo.init()
Expand All @@ -467,7 +468,7 @@ def nonce_generator():
start_nonce = 0
yield [start_nonce, start_nonce + 1000000]

print '\r\n\r\n\r\n//// YADA COIN MINER v2.1.4 ////'
print '\r\n\r\n\r\n//// YADA COIN MINER v2.1.5 ////'
gen = nonce_generator()
running_processes = []
while 1:
Expand All @@ -480,12 +481,12 @@ def nonce_generator():
if not proc.is_alive():
proc.terminate()
data = next(gen)
p = Process(target=node, args=(data,))
p = Process(target=node, args=(data, Config.to_json()))
p.start()
running_processes[i] = p
else:
data = next(gen)
p = Process(target=node, args=(data,))
p = Process(target=node, args=(data, Config.to_json()))
p.start()
running_processes.append(p)
time.sleep(1)
Expand Down

0 comments on commit a71bb17

Please sign in to comment.