github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/consensus/misc/forks.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 12:09:33</date> 10 //</624342612429508608> 11 12 13 package misc 14 15 import ( 16 "fmt" 17 18 "github.com/ethereum/go-ethereum/common" 19 "github.com/ethereum/go-ethereum/core/types" 20 "github.com/ethereum/go-ethereum/params" 21 ) 22 23 //verifyforkhashes验证符合网络硬分叉的块是否具有 24 //正确的散列,以避免客户在不同的链上离开。这是一个 25 //可选功能。 26 func VerifyForkHashes(config *params.ChainConfig, header *types.Header, uncle bool) error { 27 //我们不关心叔叔 28 if uncle { 29 return nil 30 } 31 //如果设置了homestead重定价哈希,请验证它 32 if config.EIP150Block != nil && config.EIP150Block.Cmp(header.Number) == 0 { 33 if config.EIP150Hash != (common.Hash{}) && config.EIP150Hash != header.Hash() { 34 return fmt.Errorf("homestead gas reprice fork: have 0x%x, want 0x%x", header.Hash(), config.EIP150Hash) 35 } 36 } 37 //一切还好,归来 38 return nil 39 } 40