diff --git a/core/types/block.go b/core/types/block.go index 62d5c8ea0..cc131f286 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -653,23 +653,12 @@ type Block struct { hash atomic.Value size atomic.Value - // Td is used by package core to store the total difficulty - // of the chain up to and including the block. - td *big.Int - // These fields are used by package eth to track // inter-peer block relay. ReceivedAt time.Time ReceivedFrom interface{} } -// DeprecatedTd is an old relic for extracting the TD of a block. It is in the -// code solely to facilitate upgrading the database from the old format to the -// new, after which it should be deleted. Do not use! -func (b *Block) DeprecatedTd() *big.Int { - return b.td -} - // [deprecated by eth/63] // StorageBlock defines the RLP encoding of a Block stored in the // state database. The StorageBlock encoding contains fields that @@ -945,7 +934,7 @@ func (bb *Body) DecodeRLP(s *rlp.Stream) error { // are ignored and set to values derived from the given txs, uncles // and receipts. func NewBlock(header *Header, txs []Transaction, uncles []*Header, receipts []*Receipt) *Block { - b := &Block{header: CopyHeader(header), td: new(big.Int)} + b := &Block{header: CopyHeader(header)} // TODO: panic if len(txs) != len(receipts) if len(txs) == 0 { @@ -980,7 +969,7 @@ func NewBlock(header *Header, txs []Transaction, uncles []*Header, receipts []*R // NewBlockFromStorage like NewBlock but used to create Block object when read it from DB // in this case no reason to copy parts, or re-calculate headers fields - they are all stored in DB func NewBlockFromStorage(hash common.Hash, header *Header, txs []Transaction, uncles []*Header) *Block { - b := &Block{header: header, td: new(big.Int), transactions: txs, uncles: uncles} + b := &Block{header: header, transactions: txs, uncles: uncles} b.hash.Store(hash) return b } @@ -1174,7 +1163,7 @@ func (b *StorageBlock) DecodeRLP(s *rlp.Stream) error { if err := s.Decode(&sb); err != nil { return err } - b.header, b.uncles, b.transactions, b.td = sb.Header, sb.Uncles, sb.Txs, sb.TD + b.header, b.uncles, b.transactions = sb.Header, sb.Uncles, sb.Txs return nil } @@ -1308,8 +1297,6 @@ func (b *Block) Copy() *Block { sizeValue.Store(size) } - td := big.NewInt(0).Set(b.td) - if b.ReceivedFrom != nil { panic("ReceivedFrom deep copy is not supported") } @@ -1320,7 +1307,6 @@ func (b *Block) Copy() *Block { transactions: transactions, hash: hashValue, size: sizeValue, - td: td, ReceivedAt: b.ReceivedAt, ReceivedFrom: nil, }