Skip to content

Commit d2a4bc4

Browse files
committed
Removed reference to lastBlockNumber & LastBlockNumber
1 parent 2c3a014 commit d2a4bc4

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

core/chain_manager.go

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ type ChainManager struct {
7878
eventMux *event.TypeMux
7979
genesisBlock *types.Block
8080
// Last known total difficulty
81-
mu sync.RWMutex
82-
td *big.Int
83-
lastBlockNumber uint64
84-
currentBlock *types.Block
85-
lastBlockHash []byte
81+
mu sync.RWMutex
82+
td *big.Int
83+
currentBlock *types.Block
84+
lastBlockHash []byte
8685

8786
transState *state.StateDB
8887
}
@@ -94,13 +93,6 @@ func (self *ChainManager) Td() *big.Int {
9493
return self.td
9594
}
9695

97-
func (self *ChainManager) LastBlockNumber() uint64 {
98-
self.mu.RLock()
99-
defer self.mu.RUnlock()
100-
101-
return self.lastBlockNumber
102-
}
103-
10496
func (self *ChainManager) LastBlockHash() []byte {
10597
self.mu.RLock()
10698
defer self.mu.RUnlock()
@@ -149,15 +141,14 @@ func (bc *ChainManager) setLastBlock() {
149141
rlp.Decode(bytes.NewReader(data), &block)
150142
bc.currentBlock = &block
151143
bc.lastBlockHash = block.Hash()
152-
bc.lastBlockNumber = block.Header().Number.Uint64()
153144

154145
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
155146
bc.td = ethutil.BigD(bc.db.LastKnownTD())
156147
} else {
157148
bc.Reset()
158149
}
159150

160-
chainlogger.Infof("Last block (#%d) %x TD=%v\n", bc.lastBlockNumber, bc.currentBlock.Hash(), bc.td)
151+
chainlogger.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
161152
}
162153

163154
// Block creation & chain handling
@@ -234,8 +225,6 @@ func (bc *ChainManager) insert(block *types.Block) {
234225
}
235226

236227
func (bc *ChainManager) write(block *types.Block) {
237-
bc.writeBlockInfo(block)
238-
239228
encodedBlock := ethutil.Encode(block.RlpDataForStorage())
240229
bc.db.Put(block.Hash(), encodedBlock)
241230
}
@@ -354,11 +343,6 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
354343
return td, nil
355344
}
356345

357-
// Unexported method for writing extra non-essential block info to the db
358-
func (bc *ChainManager) writeBlockInfo(block *types.Block) {
359-
bc.lastBlockNumber++
360-
}
361-
362346
func (bc *ChainManager) Stop() {
363347
if bc.CurrentBlock != nil {
364348
chainlogger.Infoln("Stopped")

0 commit comments

Comments
 (0)