core: eth: rpc: implement safe rpc block (#25165)

* core: eth: rpc: implement safe rpc block

* core: fix setHead, panics
This commit is contained in:
Marius van der Wijden
2022-07-25 18:42:05 +03:00
committed by GitHub
parent f543e6b065
commit c6dcd018d2
7 changed files with 73 additions and 5 deletions
+6
View File
@@ -55,6 +55,12 @@ func (bc *BlockChain) CurrentFinalizedBlock() *types.Block {
return bc.currentFinalizedBlock.Load().(*types.Block)
}
// CurrentSafeBlock retrieves the current safe block of the canonical
// chain. The block is retrieved from the blockchain's internal cache.
func (bc *BlockChain) CurrentSafeBlock() *types.Block {
return bc.currentSafeBlock.Load().(*types.Block)
}
// HasHeader checks if a block header is present in the database or not, caching
// it if present.
func (bc *BlockChain) HasHeader(hash common.Hash, number uint64) bool {