@@ -78,11 +78,10 @@ type ChainManager struct {
78
78
eventMux * event.TypeMux
79
79
genesisBlock * types.Block
80
80
// 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
86
85
87
86
transState * state.StateDB
88
87
}
@@ -94,13 +93,6 @@ func (self *ChainManager) Td() *big.Int {
94
93
return self .td
95
94
}
96
95
97
- func (self * ChainManager ) LastBlockNumber () uint64 {
98
- self .mu .RLock ()
99
- defer self .mu .RUnlock ()
100
-
101
- return self .lastBlockNumber
102
- }
103
-
104
96
func (self * ChainManager ) LastBlockHash () []byte {
105
97
self .mu .RLock ()
106
98
defer self .mu .RUnlock ()
@@ -149,15 +141,14 @@ func (bc *ChainManager) setLastBlock() {
149
141
rlp .Decode (bytes .NewReader (data ), & block )
150
142
bc .currentBlock = & block
151
143
bc .lastBlockHash = block .Hash ()
152
- bc .lastBlockNumber = block .Header ().Number .Uint64 ()
153
144
154
145
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
155
146
bc .td = ethutil .BigD (bc .db .LastKnownTD ())
156
147
} else {
157
148
bc .Reset ()
158
149
}
159
150
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 )
161
152
}
162
153
163
154
// Block creation & chain handling
@@ -234,8 +225,6 @@ func (bc *ChainManager) insert(block *types.Block) {
234
225
}
235
226
236
227
func (bc * ChainManager ) write (block * types.Block ) {
237
- bc .writeBlockInfo (block )
238
-
239
228
encodedBlock := ethutil .Encode (block .RlpDataForStorage ())
240
229
bc .db .Put (block .Hash (), encodedBlock )
241
230
}
@@ -354,11 +343,6 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
354
343
return td , nil
355
344
}
356
345
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
-
362
346
func (bc * ChainManager ) Stop () {
363
347
if bc .CurrentBlock != nil {
364
348
chainlogger .Infoln ("Stopped" )
0 commit comments