aboutsummaryrefslogtreecommitdiffstats
path: root/block_manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'block_manager.go')
-rw-r--r--block_manager.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/block_manager.go b/block_manager.go
index 134ca0e75..59430dca7 100644
--- a/block_manager.go
+++ b/block_manager.go
@@ -2,17 +2,18 @@ package main
import (
"fmt"
+ "github.com/ethereum/ethutil-go"
)
type BlockChain struct {
- lastBlock *Block
+ lastBlock *ethutil.Block
- genesisBlock *Block
+ genesisBlock *ethutil.Block
}
func NewBlockChain() *BlockChain {
bc := &BlockChain{}
- bc.genesisBlock = NewBlock( Encode(Genesis) )
+ bc.genesisBlock = ethutil.NewBlock( ethutil.Encode(ethutil.Genesis) )
return bc
}
@@ -30,19 +31,19 @@ func NewBlockManager() *BlockManager {
}
// Process a block.
-func (bm *BlockManager) ProcessBlock(block *Block) error {
+func (bm *BlockManager) ProcessBlock(block *ethutil.Block) error {
// TODO Validation (Or move to other part of the application)
if err := bm.ValidateBlock(block); err != nil {
return err
}
// Get the tx count. Used to create enough channels to 'join' the go routines
- txCount := len(block.transactions)
+ txCount := len(block.Transactions())
// Locking channel. When it has been fully buffered this method will return
lockChan := make(chan bool, txCount)
// Process each transaction/contract
- for _, tx := range block.transactions {
+ for _, tx := range block.Transactions() {
// If there's no recipient, it's a contract
if tx.IsContract() {
go bm.ProcessContract(tx, block, lockChan)
@@ -60,11 +61,11 @@ func (bm *BlockManager) ProcessBlock(block *Block) error {
return nil
}
-func (bm *BlockManager) ValidateBlock(block *Block) error {
+func (bm *BlockManager) ValidateBlock(block *ethutil.Block) error {
return nil
}
-func (bm *BlockManager) ProcessContract(tx *Transaction, block *Block, lockChan chan bool) {
+func (bm *BlockManager) ProcessContract(tx *ethutil.Transaction, block *ethutil.Block, lockChan chan bool) {
// Recovering function in case the VM had any errors
defer func() {
if r := recover(); r != nil {