POW fixes

This commit is contained in:
obscuren 2015-03-14 16:37:57 +01:00
parent 44636e5b82
commit 387f6bba3e
4 changed files with 1 additions and 12 deletions

@ -31,7 +31,6 @@ func GenesisBlock(db ethutil.Database) *types.Block {
genesis.Header().GasLimit = GenesisGasLimit
genesis.Header().GasUsed = ethutil.Big0
genesis.Header().Time = 0
genesis.Header().SeedHash = make([]byte, 32)
genesis.Header().MixDigest = make([]byte, 32)
genesis.Td = ethutil.Big0

@ -40,8 +40,6 @@ type Header struct {
Time uint64
// Extra data
Extra string
// SeedHash used for light client verification
SeedHash ethutil.Bytes
// Mix digest for quick checking to prevent DOS
MixDigest ethutil.Bytes
// Nonce
@ -63,7 +61,6 @@ func (self *Header) rlpData(withNonce bool) []interface{} {
self.GasUsed,
self.Time,
self.Extra,
self.SeedHash,
}
if withNonce {
fields = append(fields, self.MixDigest, self.Nonce)
@ -202,7 +199,6 @@ func (self *Block) RlpDataForStorage() interface{} {
func (self *Block) Number() *big.Int { return self.header.Number }
func (self *Block) NumberU64() uint64 { return self.header.Number.Uint64() }
func (self *Block) MixDigest() []byte { return self.header.MixDigest }
func (self *Block) SeedHash() []byte { return self.header.SeedHash }
func (self *Block) Nonce() uint64 {
return binary.BigEndian.Uint64(self.header.Nonce)
}
@ -281,10 +277,9 @@ func (self *Header) String() string {
GasUsed: %v
Time: %v
Extra: %v
SeedHash: %x
MixDigest: %x
Nonce: %x`,
self.ParentHash, self.UncleHash, self.Coinbase, self.Root, self.TxHash, self.ReceiptHash, self.Bloom, self.Difficulty, self.Number, self.GasLimit, self.GasUsed, self.Time, self.Extra, self.SeedHash, self.MixDigest, self.Nonce)
self.ParentHash, self.UncleHash, self.Coinbase, self.Root, self.TxHash, self.ReceiptHash, self.Bloom, self.Difficulty, self.Number, self.GasLimit, self.GasUsed, self.Time, self.Extra, self.MixDigest, self.Nonce)
}
type Blocks []*Block

@ -7,7 +7,6 @@ import (
"sync"
"time"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
@ -154,7 +153,6 @@ func (self *worker) wait() {
if block.Number().Uint64() == work.Number && block.Nonce() == 0 {
self.current.block.SetNonce(work.Nonce)
self.current.block.Header().MixDigest = work.MixDigest
self.current.block.Header().SeedHash = work.SeedHash
jsonlogger.LogJson(&logger.EthMinerNewBlock{
BlockHash: ethutil.Bytes2Hex(block.Hash()),
@ -191,8 +189,6 @@ func (self *worker) commitNewWork() {
defer self.mu.Unlock()
block := self.chain.NewBlock(self.coinbase)
seednum := ethash.GetSeedBlockNum(block.NumberU64())
block.Header().SeedHash = self.chain.GetBlockByNumber(seednum).SeedHash()
self.current = env(block, self.eth)
parent := self.chain.GetBlock(self.current.block.ParentHash())

@ -11,7 +11,6 @@ type Block interface {
HashNoNonce() []byte
Nonce() uint64
MixDigest() []byte
SeedHash() []byte
NumberU64() uint64
}