Skip to content

Commit

Permalink
fixed something
Browse files Browse the repository at this point in the history
  • Loading branch information
zack-bitcoin committed Jan 5, 2017
2 parents 2616249 + 18af861 commit 410b475
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/consensus/README.md

This file was deleted.

12 changes: 6 additions & 6 deletions src/consensus/mine.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, ok, []).
code_change(_OldVsn, State, _Extra) -> {ok, State}.
terminate(_, _) -> io:format("died!"), ok.
handle_info(_, X) -> {noreply, X}.
handle_cast(mine, go) ->
spawn(fun() ->
handle_cast(mine, go) ->
spawn(fun() ->
block:mine_blocks(10, 50000),
mine() end),
spawn(fun() -> easy:sync() end),
{noreply, go};
handle_cast(start, _) ->
handle_cast(start, _) ->
Cores = erlang:system_info(logical_processors_available),
io:fwrite("start mining with "),
io:fwrite(integer_to_list(Cores)),
io:fwrite(" many cores.\n"),
io:fwrite(" cores.\n"),
{noreply, go};
handle_cast(stop, _) ->
{noreply, stop};
handle_cast(_, X) -> {noreply, X}.
handle_call(status, _From, X) -> {reply, X, X};
handle_call(_, _From, X) -> {reply, X, X}.

start() ->
start() ->
gen_server:cast(?MODULE, start),
timer:sleep(100),
mine().
mine() ->
gen_server:cast(?MODULE, mine).

stop() -> gen_server:cast(?MODULE, stop).
is_on() ->
gen_server:call(?MODULE, status).

0 comments on commit 410b475

Please sign in to comment.