diff options
author | obscuren <geffobscura@gmail.com> | 2014-01-31 06:50:15 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-01-31 06:50:15 +0800 |
commit | e28632b997b4097fb6f899067ead02b90d9b887b (patch) | |
tree | 5f551ab82f5e1721314cdaf019b90835906a1dec /ethereum.go | |
parent | 8f16b6650709b4b5c48bb4c473793b23be557bbc (diff) | |
download | go-tangerine-e28632b997b4097fb6f899067ead02b90d9b887b.tar.gz go-tangerine-e28632b997b4097fb6f899067ead02b90d9b887b.tar.zst go-tangerine-e28632b997b4097fb6f899067ead02b90d9b887b.zip |
Mine?
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/ethereum.go b/ethereum.go index 2ffb6c929..810c30f49 100644 --- a/ethereum.go +++ b/ethereum.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/ethutil-go" _ "github.com/ethereum/ethwire-go" "log" - "math/big" "os" "os/signal" "path" @@ -89,26 +88,35 @@ func main() { // Fake block mining. It broadcasts a new block every 5 seconds go func() { - for { - - time.Sleep(blockTime * time.Second) + pow := ðchain.EasyPow{} + for { txs := ethereum.TxPool.Flush() - - block := ethchain.CreateBlock( - ethereum.BlockManager.BlockChain().CurrentBlock.State().Root, - ethereum.BlockManager.BlockChain().LastBlockHash, - "123", - big.NewInt(1), - big.NewInt(1), - "", - txs) - err := ethereum.BlockManager.ProcessBlockWithState(block, block.State()) - if err != nil { - log.Println(err) - } else { - //log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) - } + block := ethereum.BlockManager.BlockChain().NewBlock("82c3b0b72cf62f1a9ce97c64da8072efa28225d8", txs) + + nonce := pow.Search(block) + block.Nonce = nonce + + log.Println("nonce found:", nonce) + /* + time.Sleep(blockTime * time.Second) + + + block := ethchain.CreateBlock( + ethereum.BlockManager.BlockChain().CurrentBlock.State().Root, + ethereum.BlockManager.BlockChain().LastBlockHash, + "123", + big.NewInt(1), + big.NewInt(1), + "", + txs) + err := ethereum.BlockManager.ProcessBlockWithState(block, block.State()) + if err != nil { + log.Println(err) + } else { + //log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) + } + */ } }() } |