Foreign API: Bulk block request (#3751)

* remove non-mainnet check for PIBD requests

* add first version of get blocks function

* .\api\src\foreign.rs

* add a max value to get_blocks, documentation

* typo

* updates based on feedback
This commit is contained in:
Yeastplume
2023-06-12 09:41:08 +01:00
committed by GitHub
parent 0649ba9645
commit 01370d74ff
5 changed files with 370 additions and 3 deletions
+7
View File
@@ -1445,6 +1445,13 @@ impl Chain {
.map_err(|e| Error::StoreErr(e, "chain get block".to_owned()))
}
/// Gets the earliest stored block (tail)
pub fn get_tail(&self) -> Result<Tip, Error> {
self.store
.tail()
.map_err(|e| Error::StoreErr(e, "chain get tail".to_owned()))
}
/// Gets a block header by hash
pub fn get_block_header(&self, h: &Hash) -> Result<BlockHeader, Error> {
self.store