reworking messages => log

This commit is contained in:
obscuren
2015-01-28 10:23:18 +01:00
parent c54a85ee64
commit f3e78c8f3c
5 changed files with 76 additions and 114 deletions

View File

@@ -330,3 +330,24 @@ func (sm *BlockProcessor) GetMessages(block *types.Block) (messages []*state.Mes
return state.Manifest().Messages, nil
}
func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) {
if !sm.bc.HasBlock(block.Header().ParentHash) {
return nil, ParentError(block.Header().ParentHash)
}
sm.lastAttemptedBlock = block
var (
parent = sm.bc.GetBlock(block.Header().ParentHash)
//state = state.New(parent.Trie().Copy())
state = state.New(parent.Root(), sm.db)
)
defer state.Reset()
sm.TransitionState(state, parent, block)
sm.AccumelateRewards(state, block, parent)
return state.Logs(), nil
}