aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-03 08:09:45 +0800
committerobscuren <geffobscura@gmail.com>2014-02-03 08:09:45 +0800
commitec883db3b1172f75761c066d4b022858d1f9df5d (patch)
tree5ebb966a6bb273b3f98a3ae7a2e0b051b4356aa4
parent00ec15c82eafc493c3349aea24c4fef315e5692e (diff)
downloadgo-tangerine-ec883db3b1172f75761c066d4b022858d1f9df5d.tar.gz
go-tangerine-ec883db3b1172f75761c066d4b022858d1f9df5d.tar.zst
go-tangerine-ec883db3b1172f75761c066d4b022858d1f9df5d.zip
TApply transactions
-rw-r--r--ethereum.go30
1 files changed, 5 insertions, 25 deletions
diff --git a/ethereum.go b/ethereum.go
index 8a241f4cc..bae473854 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -84,40 +84,20 @@ func main() {
addr, _ := hex.DecodeString("82c3b0b72cf62f1a9ce97c64da8072efa28225d8")
for {
- //time.Sleep(blockTime * time.Second)
-
txs := ethereum.TxPool.Flush()
+ // Create a new block which we're going to mine
block := ethereum.BlockManager.BlockChain().NewBlock(addr, txs)
-
+ // Apply all transactions to the block
+ ethereum.BlockManager.ApplyTransactions(block)
+ // Search the nonce
block.Nonce = pow.Search(block)
-
+ // Process the block and verify
err := ethereum.BlockManager.ProcessBlock(block)
if err != nil {
log.Println(err)
} else {
- //log.Println("nonce found:", nonce)
log.Println("\n+++++++ MINED BLK +++++++\n", block.String())
}
- //os.Exit(1)
-
- /*
-
-
- 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())
- }
- */
}
}()
}