Basic structure miner

This commit is contained in:
obscuren
2015-02-09 16:20:34 +01:00
parent b22f0f2ef5
commit da2fae0e43
9 changed files with 198 additions and 293 deletions

View File

@ -16,6 +16,11 @@ import (
var chainlogger = logger.NewLogger("CHAIN")
type ChainEvent struct {
Block *types.Block
Td *big.Int
}
type StateQuery interface {
GetAccount(addr []byte) *state.StateObject
}
@ -175,6 +180,9 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block {
ethutil.BigPow(2, 32),
nil,
"")
block.SetUncles(nil)
block.SetTransactions(nil)
block.SetReceipts(nil)
parent := bc.currentBlock
if parent != nil {
@ -385,8 +393,9 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
self.setTotalDifficulty(td)
self.insert(block)
self.transState = state.New(cblock.Root(), self.db) //state.New(cblock.Trie().Copy())
}
self.eventMux.Post(ChainEvent{block, td})
}
}
self.mu.Unlock()