aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_processor.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-07 01:57:39 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-08 04:29:02 +0800
commita23478c0be94e1e727a64d20341b8d6f98d7f0a0 (patch)
tree27020e2617acb8881332cac998965acdee6c2eb9 /core/block_processor.go
parentd7580f21f65beaf896bfc004cf13d28ed87f2ae3 (diff)
downloadgo-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.gz
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.bz2
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.lz
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.xz
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.tar.zst
go-tangerine-a23478c0be94e1e727a64d20341b8d6f98d7f0a0.zip
core, eth, trie, xeth: merged state, chain, extra databases in one
Diffstat (limited to 'core/block_processor.go')
-rw-r--r--core/block_processor.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index 5a2ad8377..38bf772fb 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -41,8 +41,7 @@ const (
)
type BlockProcessor struct {
- db common.Database
- extraDb common.Database
+ chainDb common.Database
// Mutex for locking the block processor. Blocks can only be handled one at a time
mutex sync.Mutex
// Canonical block chain
@@ -57,10 +56,9 @@ type BlockProcessor struct {
eventMux *event.TypeMux
}
-func NewBlockProcessor(db, extra common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor {
+func NewBlockProcessor(db common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor {
sm := &BlockProcessor{
- db: db,
- extraDb: extra,
+ chainDb: db,
mem: make(map[string]*big.Int),
Pow: pow,
bc: chainManager,
@@ -201,7 +199,7 @@ func (sm *BlockProcessor) Process(block *types.Block) (logs state.Logs, receipts
func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs state.Logs, receipts types.Receipts, err error) {
// Create a new state based on the parent's root (e.g., create copy)
- state := state.New(parent.Root(), sm.db)
+ state := state.New(parent.Root(), sm.chainDb)
header := block.Header()
uncles := block.Uncles()
txs := block.Transactions()
@@ -342,7 +340,7 @@ func (sm *BlockProcessor) VerifyUncles(statedb *state.StateDB, block, parent *ty
// GetBlockReceipts returns the receipts beloniging to the block hash
func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts {
if block := sm.ChainManager().GetBlock(bhash); block != nil {
- return GetBlockReceipts(sm.extraDb, block.Hash())
+ return GetBlockReceipts(sm.chainDb, block.Hash())
}
return nil
@@ -352,7 +350,7 @@ func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts {
// where it tries to get it from the (updated) method which gets them from the receipts or
// the depricated way by re-processing the block.
func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) {
- receipts := GetBlockReceipts(sm.extraDb, block.Hash())
+ receipts := GetBlockReceipts(sm.chainDb, block.Hash())
if len(receipts) > 0 {
// coalesce logs
for _, receipt := range receipts {
@@ -364,7 +362,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
// TODO: remove backward compatibility
var (
parent = sm.bc.GetBlock(block.ParentHash())
- state = state.New(parent.Root(), sm.db)
+ state = state.New(parent.Root(), sm.chainDb)
)
sm.TransitionState(state, parent, block, true)