From 6ab368cf7426195a0d44b14ad6d82c020c024395 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 28 Jan 2014 15:35:19 +0100 Subject: Changed block chain specific methods --- ethereum.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ethereum.go') diff --git a/ethereum.go b/ethereum.go index d58033cdc..8608ca47a 100644 --- a/ethereum.go +++ b/ethereum.go @@ -84,7 +84,7 @@ func main() { ethereum.Start() if StartMining { - blockTime := time.Duration(15) + blockTime := time.Duration(2) log.Printf("Dev Test Mining started. Blocks found each %d seconds\n", blockTime) // Fake block mining. It broadcasts a new block every 5 seconds @@ -96,8 +96,8 @@ func main() { txs := ethereum.TxPool.Flush() block := ethchain.CreateBlock( - ethereum.BlockManager.CurrentBlock.State().Root, - ethereum.BlockManager.LastBlockHash, + ethereum.BlockManager.BlockChain().CurrentBlock.State().Root, + ethereum.BlockManager.BlockChain().LastBlockHash, "123", big.NewInt(1), big.NewInt(1), -- cgit v1.2.3 From 27a03d3eea5451ddb84dbb1ff33ee916259635d0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 30 Jan 2014 00:47:09 +0100 Subject: Updated to the new Trie --- ethereum.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ethereum.go') diff --git a/ethereum.go b/ethereum.go index 8608ca47a..2ffb6c929 100644 --- a/ethereum.go +++ b/ethereum.go @@ -84,7 +84,7 @@ func main() { ethereum.Start() if StartMining { - blockTime := time.Duration(2) + 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 @@ -107,7 +107,7 @@ func main() { if err != nil { log.Println(err) } else { - log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) + //log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) } } }() -- cgit v1.2.3 From e28632b997b4097fb6f899067ead02b90d9b887b Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 30 Jan 2014 23:50:15 +0100 Subject: Mine? --- ethereum.go | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'ethereum.go') 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()) + } + */ } }() } -- cgit v1.2.3