Skip to content

Commit

Permalink
add feature to specify number of cores used for mining
Browse files Browse the repository at this point in the history
  • Loading branch information
pdxwebdev committed Oct 12, 2018
1 parent 9dd6eb9 commit 2d90ff3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def retrace(self, block, peer):
parser.add_argument('config', default="config.json", nargs="?", help='config file')
parser.add_argument('to', default="", nargs="?", help='to')
parser.add_argument('value', default=0, nargs="?", help='amount')
parser.add_argument('-c', '--cores', default=multiprocessing.cpu_count(), help='Specify number of cores to use')
args = parser.parse_args()

if args.mode == 'config' and args.config:
Expand Down Expand Up @@ -475,14 +476,15 @@ def nonce_generator():
yield [start_nonce, start_nonce + 1000000]

print '\r\n\r\n\r\n//// YADA COIN MINER v2.1.5 ////'
print "Core count:", args.cores
gen = nonce_generator()
running_processes = []
while 1:
Peers.init()
if not Peers.peers:
time.sleep(1)
continue
if len(running_processes) >= multiprocessing.cpu_count():
if len(running_processes) >= int(args.cores):
for i, proc in enumerate(running_processes):
if not proc.is_alive():
proc.terminate()
Expand Down

0 comments on commit 2d90ff3

Please sign in to comment.