feat(sync): headers commit threshold (#296)

* headers stream init

* fix tests

* return header if available regardless of control flow

* proper stream termination & docs

* upd headers stage to consume stream

* adjust response validation for stream

* use cursor.insert for headers

* wrap poll_next in a loop to bypass poking waker

* fix typo

* fix last td lookup

* Apply suggestions from code review

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* misc

* remove waker ref

* dedup response handling logic

* clippy

* add docs to poll

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
Roman Krasiuk
2022-12-06 08:28:11 +02:00
committed by Georgios Konstantopoulos
parent 2671cd1cb6
commit 9628d03871
5 changed files with 385 additions and 187 deletions

View File

@ -266,6 +266,11 @@ impl SealedHeader {
pub fn hash(&self) -> BlockHash {
self.hash
}
/// Return the number hash tuple.
pub fn num_hash(&self) -> (BlockNumber, BlockHash) {
(self.number, self.hash)
}
}
/// Represents the direction for a headers request depending on the `reverse` field of the request.