Removed reference to lastBlockNumber & LastBlockNumber
This commit is contained in:
parent
2c3a014f03
commit
d2a4bc4d73
|
@ -80,7 +80,6 @@ type ChainManager struct {
|
||||||
// Last known total difficulty
|
// Last known total difficulty
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
td *big.Int
|
td *big.Int
|
||||||
lastBlockNumber uint64
|
|
||||||
currentBlock *types.Block
|
currentBlock *types.Block
|
||||||
lastBlockHash []byte
|
lastBlockHash []byte
|
||||||
|
|
||||||
|
@ -94,13 +93,6 @@ func (self *ChainManager) Td() *big.Int {
|
||||||
return self.td
|
return self.td
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *ChainManager) LastBlockNumber() uint64 {
|
|
||||||
self.mu.RLock()
|
|
||||||
defer self.mu.RUnlock()
|
|
||||||
|
|
||||||
return self.lastBlockNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *ChainManager) LastBlockHash() []byte {
|
func (self *ChainManager) LastBlockHash() []byte {
|
||||||
self.mu.RLock()
|
self.mu.RLock()
|
||||||
defer self.mu.RUnlock()
|
defer self.mu.RUnlock()
|
||||||
|
@ -149,7 +141,6 @@ func (bc *ChainManager) setLastBlock() {
|
||||||
rlp.Decode(bytes.NewReader(data), &block)
|
rlp.Decode(bytes.NewReader(data), &block)
|
||||||
bc.currentBlock = &block
|
bc.currentBlock = &block
|
||||||
bc.lastBlockHash = block.Hash()
|
bc.lastBlockHash = block.Hash()
|
||||||
bc.lastBlockNumber = block.Header().Number.Uint64()
|
|
||||||
|
|
||||||
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
|
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
|
||||||
bc.td = ethutil.BigD(bc.db.LastKnownTD())
|
bc.td = ethutil.BigD(bc.db.LastKnownTD())
|
||||||
|
@ -157,7 +148,7 @@ func (bc *ChainManager) setLastBlock() {
|
||||||
bc.Reset()
|
bc.Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
chainlogger.Infof("Last block (#%d) %x TD=%v\n", bc.lastBlockNumber, bc.currentBlock.Hash(), bc.td)
|
chainlogger.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block creation & chain handling
|
// Block creation & chain handling
|
||||||
|
@ -234,8 +225,6 @@ func (bc *ChainManager) insert(block *types.Block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *ChainManager) write(block *types.Block) {
|
func (bc *ChainManager) write(block *types.Block) {
|
||||||
bc.writeBlockInfo(block)
|
|
||||||
|
|
||||||
encodedBlock := ethutil.Encode(block.RlpDataForStorage())
|
encodedBlock := ethutil.Encode(block.RlpDataForStorage())
|
||||||
bc.db.Put(block.Hash(), encodedBlock)
|
bc.db.Put(block.Hash(), encodedBlock)
|
||||||
}
|
}
|
||||||
|
@ -354,11 +343,6 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
|
||||||
return td, nil
|
return td, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unexported method for writing extra non-essential block info to the db
|
|
||||||
func (bc *ChainManager) writeBlockInfo(block *types.Block) {
|
|
||||||
bc.lastBlockNumber++
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bc *ChainManager) Stop() {
|
func (bc *ChainManager) Stop() {
|
||||||
if bc.CurrentBlock != nil {
|
if bc.CurrentBlock != nil {
|
||||||
chainlogger.Infoln("Stopped")
|
chainlogger.Infoln("Stopped")
|
||||||
|
|
Loading…
Reference in New Issue