aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-09 23:20:34 +0800
committerobscuren <geffobscura@gmail.com>2015-02-10 20:04:38 +0800
commitda2fae0e437f9467a943acfe0571a8a24e8e76fd (patch)
treed760375fbcd441a6460c1ea1d7db930f78e1df20 /core
parentb22f0f2ef51bdb769259b3cf7d9ee0e8e5b0635e (diff)
downloaddexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar.gz
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar.bz2
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar.lz
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar.xz
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.tar.zst
dexon-da2fae0e437f9467a943acfe0571a8a24e8e76fd.zip
Basic structure miner
Diffstat (limited to 'core')
-rw-r--r--core/block_processor.go10
-rw-r--r--core/chain_manager.go11
2 files changed, 15 insertions, 6 deletions
diff --git a/core/block_processor.go b/core/block_processor.go
index d6755e7f7..8c4e53813 100644
--- a/core/block_processor.go
+++ b/core/block_processor.go
@@ -7,7 +7,6 @@ import (
"sync"
"time"
- "github.com/ethereum/c-ethash/go-ethash"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
@@ -15,7 +14,7 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/pow"
- _ "github.com/ethereum/go-ethereum/pow/ezp"
+ "github.com/ethereum/go-ethereum/pow/ezp"
"github.com/ethereum/go-ethereum/state"
"gopkg.in/fatih/set.v0"
)
@@ -65,9 +64,10 @@ type BlockProcessor struct {
func NewBlockProcessor(db ethutil.Database, txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor {
sm := &BlockProcessor{
- db: db,
- mem: make(map[string]*big.Int),
- Pow: &ethash.Ethash{},
+ db: db,
+ mem: make(map[string]*big.Int),
+ //Pow: &ethash.Ethash{},
+ Pow: ezp.New(),
bc: chainManager,
eventMux: eventMux,
txpool: txpool,
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 0847980ca..308e958fe 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -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()