aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-07-08 23:48:17 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-07-16 19:29:59 +0800
commita0cc73a27acf0d8326b3eec0bb27132a8ba9eab4 (patch)
tree616bb4369a9559e60a297e7e41cbb646d8b0d4d8 /miner
parent682c4531afeaa3aa6aded275d72eb62819c1e0d7 (diff)
downloadgo-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar.gz
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar.bz2
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar.lz
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar.xz
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.tar.zst
go-tangerine-a0cc73a27acf0d8326b3eec0bb27132a8ba9eab4.zip
[release/1.4.10] cmd, core, miner: add extradata validation to consensus rules
(cherry picked from commit a87089fd2dc08a69a4a4f1ef93db9a2871d819a3)
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 48cde168b..950971eb3 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -17,6 +17,7 @@
package miner
import (
+ "bytes"
"fmt"
"math/big"
"sync"
@@ -469,12 +470,17 @@ func (self *worker) commitNewWork() {
Extra: self.extra,
Time: big.NewInt(tstamp),
}
- // If we are doing a DAO hard-fork check whether to override the extra-data or not
+ // If we are care about TheDAO hard-fork check whether to override the extra-data or not
if daoBlock := self.config.DAOForkBlock; daoBlock != nil {
// Check whether the block is among the fork extra-override range
limit := new(big.Int).Add(daoBlock, params.DAOForkExtraRange)
if daoBlock.Cmp(header.Number) <= 0 && header.Number.Cmp(limit) < 0 {
- header.Extra = common.CopyBytes(params.DAOForkBlockExtra)
+ // Depending whether we support or oppose the fork, override differently
+ if self.config.DAOForkSupport {
+ header.Extra = common.CopyBytes(params.DAOForkBlockExtra)
+ } else if bytes.Compare(header.Extra, params.DAOForkBlockExtra) == 0 {
+ header.Extra = []byte{} // If miner opposes, don't let it use the reserved extra-data
+ }
}
}
previous := self.current