aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-11-02 20:44:13 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-11-13 21:55:30 +0800
commit4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188 (patch)
tree5c55a3088c944ddf517aa4d7c85c5dc7f02d00e4 /miner/worker.go
parent5cd86443ee071b5e3abe4995c777ce467c29f2c5 (diff)
downloaddexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.gz
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.bz2
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.lz
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.xz
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.tar.zst
dexon-4dca5d4db7fc2c1fac5a2e24dcc99b15573f0188.zip
core/types, params: EIP#155
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/miner/worker.go b/miner/worker.go
index f98145e8f..2933b6bd3 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -63,7 +63,9 @@ type uint64RingBuffer struct {
// Work is the workers current environment and holds
// all of the current state information
type Work struct {
- config *params.ChainConfig
+ config *params.ChainConfig
+ signer types.Signer
+
state *state.StateDB // apply state changes here
ancestors *set.Set // ancestor set (used for checking uncle parent validity)
family *set.Set // family set (used for checking uncle invalidity)
@@ -235,7 +237,7 @@ func (self *worker) update() {
if atomic.LoadInt32(&self.mining) == 0 {
self.currentMu.Lock()
- acc, _ := ev.Tx.From()
+ acc, _ := types.Sender(self.current.signer, ev.Tx)
txs := map[common.Address]types.Transactions{acc: types.Transactions{ev.Tx}}
txset := types.NewTransactionsByPriceAndNonce(txs)
@@ -367,6 +369,7 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
}
work := &Work{
config: self.config,
+ signer: types.NewEIP155Signer(self.config.ChainId),
state: state,
ancestors: set.New(),
family: set.New(),
@@ -570,7 +573,17 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
}
// Error may be ignored here. The error has already been checked
// during transaction acceptance is the transaction pool.
- from, _ := tx.From()
+ //
+ // We use the eip155 signer regardless of the current hf.
+ from, _ := types.Sender(env.signer, tx)
+ // Check whether the tx is replay protected. If we're not in the EIP155 hf
+ // phase, start ignoring the sender until we do.
+ if tx.Protected() && !env.config.IsEIP155(env.header.Number) {
+ glog.V(logger.Detail).Infof("Transaction (%x) is replay protected, but we haven't yet hardforked. Transaction will be ignored until we hardfork.\n", tx.Hash())
+
+ txs.Pop()
+ continue
+ }
// Ignore any transactions (and accounts subsequently) with low gas limits
if tx.GasPrice().Cmp(gasPrice) < 0 && !env.ownedAccounts.Has(from) {