consensus/clique, core: API cleanup (#23100)
This removes some code: - The clique engine calculated the snapshot twice when verifying headers/blocks. - The method GetBlockHashesFromHash in Header/Block/Lightchain was only used by tests. It is now removed from the API. - The method GetTdByHash internally looked up the number before calling GetTd(hash, num). In many cases, callers already had the number, and used this method just because it has a shorter name. I have removed the method to make the API surface smaller.
This commit is contained in:
committed by
GitHub
parent
da3da7c0e7
commit
6289137827
@ -182,7 +182,7 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
|
||||
// If we're in fast sync mode, return that directly
|
||||
if atomic.LoadUint32(&cs.handler.fastSync) == 1 {
|
||||
block := cs.handler.chain.CurrentFastBlock()
|
||||
td := cs.handler.chain.GetTdByHash(block.Hash())
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64())
|
||||
return downloader.FastSync, td
|
||||
}
|
||||
// We are probably in full sync, but we might have rewound to before the
|
||||
@ -190,7 +190,7 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
|
||||
if pivot := rawdb.ReadLastPivotNumber(cs.handler.database); pivot != nil {
|
||||
if head := cs.handler.chain.CurrentBlock(); head.NumberU64() < *pivot {
|
||||
block := cs.handler.chain.CurrentFastBlock()
|
||||
td := cs.handler.chain.GetTdByHash(block.Hash())
|
||||
td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64())
|
||||
return downloader.FastSync, td
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user