diff options
author | Ramesh Nair <ram@hiddentao.com> | 2014-02-01 12:25:40 +0800 |
---|---|---|
committer | Ramesh Nair <ram@hiddentao.com> | 2014-02-01 12:25:40 +0800 |
commit | f4433a680482fda18b9273195ed7c65f5314f157 (patch) | |
tree | 5fd588a3aa44be7008df24f4e67629e4d616e2f0 /ethereum.go | |
parent | 9cdf8f2cba0469429f3d3f2aeacdbb4844928a0a (diff) | |
parent | e28632b997b4097fb6f899067ead02b90d9b887b (diff) | |
download | go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar.gz go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar.bz2 go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar.lz go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar.xz go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.tar.zst go-tangerine-f4433a680482fda18b9273195ed7c65f5314f157.zip |
Merge branch 'master' into readme
Conflicts:
README.md
Diffstat (limited to 'ethereum.go')
-rw-r--r-- | ethereum.go | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/ethereum.go b/ethereum.go index d58033cdc..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" @@ -84,31 +83,40 @@ func main() { ethereum.Start() if StartMining { - blockTime := time.Duration(15) + blockTime := time.Duration(10) log.Printf("Dev Test Mining started. Blocks found each %d seconds\n", blockTime) // 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.CurrentBlock.State().Root, - ethereum.BlockManager.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()) + } + */ } }() } |