|
|
@ -84,8 +84,6 @@ type Block struct { |
|
|
|
Time int64 |
|
|
|
Time int64 |
|
|
|
// The block number
|
|
|
|
// The block number
|
|
|
|
Number *big.Int |
|
|
|
Number *big.Int |
|
|
|
// Minimum Gas Price
|
|
|
|
|
|
|
|
MinGasPrice *big.Int |
|
|
|
|
|
|
|
// Gas limit
|
|
|
|
// Gas limit
|
|
|
|
GasLimit *big.Int |
|
|
|
GasLimit *big.Int |
|
|
|
// Gas used
|
|
|
|
// Gas used
|
|
|
@ -124,16 +122,15 @@ func CreateBlock(root interface{}, |
|
|
|
extra string) *Block { |
|
|
|
extra string) *Block { |
|
|
|
|
|
|
|
|
|
|
|
block := &Block{ |
|
|
|
block := &Block{ |
|
|
|
PrevHash: prevHash, |
|
|
|
PrevHash: prevHash, |
|
|
|
Coinbase: base, |
|
|
|
Coinbase: base, |
|
|
|
Difficulty: Difficulty, |
|
|
|
Difficulty: Difficulty, |
|
|
|
Nonce: Nonce, |
|
|
|
Nonce: Nonce, |
|
|
|
Time: time.Now().Unix(), |
|
|
|
Time: time.Now().Unix(), |
|
|
|
Extra: extra, |
|
|
|
Extra: extra, |
|
|
|
UncleSha: nil, |
|
|
|
UncleSha: nil, |
|
|
|
GasUsed: new(big.Int), |
|
|
|
GasUsed: new(big.Int), |
|
|
|
MinGasPrice: new(big.Int), |
|
|
|
GasLimit: new(big.Int), |
|
|
|
GasLimit: new(big.Int), |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
block.SetUncles([]*Block{}) |
|
|
|
block.SetUncles([]*Block{}) |
|
|
|
|
|
|
|
|
|
|
@ -300,12 +297,11 @@ func (self *Block) setHeader(header *ethutil.Value) { |
|
|
|
self.LogsBloom = header.Get(6).Bytes() |
|
|
|
self.LogsBloom = header.Get(6).Bytes() |
|
|
|
self.Difficulty = header.Get(7).BigInt() |
|
|
|
self.Difficulty = header.Get(7).BigInt() |
|
|
|
self.Number = header.Get(8).BigInt() |
|
|
|
self.Number = header.Get(8).BigInt() |
|
|
|
self.MinGasPrice = header.Get(9).BigInt() |
|
|
|
self.GasLimit = header.Get(9).BigInt() |
|
|
|
self.GasLimit = header.Get(10).BigInt() |
|
|
|
self.GasUsed = header.Get(10).BigInt() |
|
|
|
self.GasUsed = header.Get(11).BigInt() |
|
|
|
self.Time = int64(header.Get(11).BigInt().Uint64()) |
|
|
|
self.Time = int64(header.Get(12).BigInt().Uint64()) |
|
|
|
self.Extra = header.Get(12).Str() |
|
|
|
self.Extra = header.Get(13).Str() |
|
|
|
self.Nonce = header.Get(13).Bytes() |
|
|
|
self.Nonce = header.Get(14).Bytes() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewUncleBlockFromValue(header *ethutil.Value) *Block { |
|
|
|
func NewUncleBlockFromValue(header *ethutil.Value) *Block { |
|
|
@ -351,8 +347,6 @@ func (block *Block) miningHeader() []interface{} { |
|
|
|
block.Difficulty, |
|
|
|
block.Difficulty, |
|
|
|
// The block number
|
|
|
|
// The block number
|
|
|
|
block.Number, |
|
|
|
block.Number, |
|
|
|
// Block minimum gas price
|
|
|
|
|
|
|
|
block.MinGasPrice, |
|
|
|
|
|
|
|
// Block upper gas bound
|
|
|
|
// Block upper gas bound
|
|
|
|
block.GasLimit, |
|
|
|
block.GasLimit, |
|
|
|
// Block gas used
|
|
|
|
// Block gas used
|
|
|
@ -380,7 +374,6 @@ func (block *Block) String() string { |
|
|
|
Bloom: %x |
|
|
|
Bloom: %x |
|
|
|
Difficulty: %v |
|
|
|
Difficulty: %v |
|
|
|
Number: %v |
|
|
|
Number: %v |
|
|
|
MinGas: %v |
|
|
|
|
|
|
|
MaxLimit: %v |
|
|
|
MaxLimit: %v |
|
|
|
GasUsed: %v |
|
|
|
GasUsed: %v |
|
|
|
Time: %v |
|
|
|
Time: %v |
|
|
@ -399,7 +392,6 @@ func (block *Block) String() string { |
|
|
|
block.LogsBloom, |
|
|
|
block.LogsBloom, |
|
|
|
block.Difficulty, |
|
|
|
block.Difficulty, |
|
|
|
block.Number, |
|
|
|
block.Number, |
|
|
|
block.MinGasPrice, |
|
|
|
|
|
|
|
block.GasLimit, |
|
|
|
block.GasLimit, |
|
|
|
block.GasUsed, |
|
|
|
block.GasUsed, |
|
|
|
block.Time, |
|
|
|
block.Time, |
|
|
|