aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-18 23:58:22 +0800
committerobscuren <geffobscura@gmail.com>2014-11-18 23:58:22 +0800
commita1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b (patch)
treeaee891c8f02591e16377a6bf047c13f12d6d5123 /miner
parent62cd9946ee16758a4e368cd0b5a0ba9fa4d94705 (diff)
downloaddexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.gz
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.bz2
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.lz
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.xz
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.zst
dexon-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.zip
Begin of moving objects to types package
* Block(s) * Transaction(s)
Diffstat (limited to 'miner')
-rw-r--r--miner/miner.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/miner/miner.go b/miner/miner.go
index a678a6895..b25e25357 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/chain"
+ "github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/wire"
@@ -44,7 +45,7 @@ type LocalTx struct {
Value string `json:"value"`
}
-func (self *LocalTx) Sign(key []byte) *chain.Transaction {
+func (self *LocalTx) Sign(key []byte) *types.Transaction {
return nil
}
@@ -54,7 +55,7 @@ type Miner struct {
eth *eth.Ethereum
events event.Subscription
- uncles chain.Blocks
+ uncles types.Blocks
localTxs map[int]*LocalTx
localTxId int
@@ -212,7 +213,7 @@ func (self *Miner) mine() {
nonce := self.pow.Search(block, self.powQuitCh)
if nonce != nil {
block.Nonce = nonce
- lchain := chain.NewChain(chain.Blocks{block})
+ lchain := chain.NewChain(types.Blocks{block})
_, err := chainMan.TestChain(lchain)
if err != nil {
minerlogger.Infoln(err)
@@ -229,15 +230,15 @@ func (self *Miner) mine() {
}
}
-func (self *Miner) finiliseTxs() chain.Transactions {
+func (self *Miner) finiliseTxs() types.Transactions {
// Sort the transactions by nonce in case of odd network propagation
- var txs chain.Transactions
+ var txs types.Transactions
state := self.eth.BlockManager().TransState()
// XXX This has to change. Coinbase is, for new, same as key.
key := self.eth.KeyManager()
for _, ltx := range self.localTxs {
- tx := chain.NewTransactionMessage(ltx.To, ethutil.Big(ltx.Value), ethutil.Big(ltx.Gas), ethutil.Big(ltx.GasPrice), ltx.Data)
+ tx := types.NewTransactionMessage(ltx.To, ethutil.Big(ltx.Value), ethutil.Big(ltx.Gas), ethutil.Big(ltx.GasPrice), ltx.Data)
tx.Nonce = state.GetNonce(self.Coinbase)
state.SetNonce(self.Coinbase, tx.Nonce+1)
@@ -247,7 +248,7 @@ func (self *Miner) finiliseTxs() chain.Transactions {
}
txs = append(txs, self.eth.TxPool().CurrentTransactions()...)
- sort.Sort(chain.TxByNonce{txs})
+ sort.Sort(types.TxByNonce{txs})
return txs
}