TApply transactions

This commit is contained in:
obscuren 2014-02-03 01:09:45 +01:00
parent 00ec15c82e
commit ec883db3b1

View File

@ -84,40 +84,20 @@ func main() {
addr, _ := hex.DecodeString("82c3b0b72cf62f1a9ce97c64da8072efa28225d8") addr, _ := hex.DecodeString("82c3b0b72cf62f1a9ce97c64da8072efa28225d8")
for { for {
//time.Sleep(blockTime * time.Second)
txs := ethereum.TxPool.Flush() txs := ethereum.TxPool.Flush()
// Create a new block which we're going to mine
block := ethereum.BlockManager.BlockChain().NewBlock(addr, txs) 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) block.Nonce = pow.Search(block)
// Process the block and verify
err := ethereum.BlockManager.ProcessBlock(block) err := ethereum.BlockManager.ProcessBlock(block)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} else { } else {
//log.Println("nonce found:", nonce)
log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) 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())
}
*/
} }
}() }()
} }