good morning!!!!

Skip to content
Snippets Groups Projects
Commit e403b28e authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Fixed miner

parent 97b98b12
No related branches found
No related tags found
No related merge requests found
...@@ -131,15 +131,14 @@ func main() { ...@@ -131,15 +131,14 @@ func main() {
// Create a new block which we're going to mine // Create a new block which we're going to mine
block := ethereum.BlockChain().NewBlock(addr, txs) block := ethereum.BlockChain().NewBlock(addr, txs)
log.Println("Mining on new block. Includes", len(block.Transactions()), "transactions") log.Println("Mining on new block. Includes", len(block.Transactions()), "transactions")
// Apply all transactions to the block
ethereum.StateManager().ApplyTransactions(block, block.Transactions())
ethereum.StateManager().Prepare(block.State(), block.State()) ethereum.StateManager().Prepare(block.State(), block.State())
// Apply all transactions to the block
ethereum.StateManager().ApplyTransactions(block, block.Transactions())
ethereum.StateManager().AccumelateRewards(block) ethereum.StateManager().AccumelateRewards(block)
// Search the nonce // Search the nonce
block.Nonce = pow.Search(block) block.Nonce = pow.Search(block)
ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val})
ethereum.StateManager().PrepareDefault(block) ethereum.StateManager().PrepareDefault(block)
err := ethereum.StateManager().ProcessBlock(block) err := ethereum.StateManager().ProcessBlock(block)
...@@ -148,6 +147,7 @@ func main() { ...@@ -148,6 +147,7 @@ func main() {
} else { } else {
log.Println("\n+++++++ MINED BLK +++++++\n", ethereum.BlockChain().CurrentBlock) log.Println("\n+++++++ MINED BLK +++++++\n", ethereum.BlockChain().CurrentBlock)
log.Printf("🔨 Mined block %x\n", block.Hash()) log.Printf("🔨 Mined block %x\n", block.Hash())
ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val})
} }
} }
}() }()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment