Skip to content

Commit

Permalink
generalized api for mining blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
zack-bitcoin committed Jan 17, 2017
1 parent 1616265 commit 89bf9ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions channel_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# sh start.sh 3020
# Make sure each server is running from code copied into a different folder. It is important that they each maintain different trie databases, and don't share a trie.

curl -i -d '["mine_block"]' http://localhost:3021
curl -i -d '["mine_block"]' http://localhost:3011
curl -i -d '["mine_block, 1, 1000000"]' http://localhost:3021
curl -i -d '["mine_block, 1, 1000000"]' http://localhost:3011

curl -i -d '["add_peer", [127,0,0,1], 3010]' http://localhost:3021
curl -i -d '["add_peer", [127,0,0,1], 3020]' http://localhost:3011
Expand Down
9 changes: 5 additions & 4 deletions src/networking/internal_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ doit({spend, To, Amount}) ->
easy:spend(To, Amount),
%tx_pool_feeder:absorb(keys:sign(spend_tx:spend(To, Amount, Fee)));
{ok, ok};
doit({mine_block}) ->
doit({mine_block, Many, Times}) ->
{_,_,_,Txs} = tx_pool:data(),
Block = block:make(top:doit(), Txs, keys:id()),
PowBlock = block:mine(Block, 10000000),
block_absorber:doit(PowBlock);
mine_blocks(Many, Times);
%Block = block:make(top:doit(), Txs, keys:id()),
%PowBlock = block:mine(Block, 10000000),
%block_absorber:doit(PowBlock);
doit({create_channel, Partner, Bal1, Bal2, Type, Fee}) ->
keys:sign(to_channel_tx:create_channel(Partner, Bal1, Bal2, Type, Fee));
doit({to_channel, IP, Port, Inc1, Inc2, Fee}) ->
Expand Down

0 comments on commit 89bf9ad

Please sign in to comment.