Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/chronik/client.py
| Show First 20 Lines • Show All 352 Lines • ▼ Show 20 Lines | ) -> ChronikResponse: | ||||
| query = _page_query_params(page, page_size) | query = _page_query_params(page, page_size) | ||||
| return self._request_get( | return self._request_get( | ||||
| f"/block-txs/{hash_or_height}{query}", pb.TxHistoryPage | f"/block-txs/{hash_or_height}{query}", pb.TxHistoryPage | ||||
| ) | ) | ||||
| def blocks(self, start_height: int, end_height: int) -> ChronikResponse: | def blocks(self, start_height: int, end_height: int) -> ChronikResponse: | ||||
| return self._request_get(f"/blocks/{start_height}/{end_height}", pb.Blocks) | return self._request_get(f"/blocks/{start_height}/{end_height}", pb.Blocks) | ||||
| def block_header(self, hash_or_height: Union[str, int]) -> ChronikResponse: | def block_header( | ||||
| return self._request_get(f"/block-header/{hash_or_height}", pb.BlockHeader) | self, hash_or_height: Union[str, int], checkpoint_height: int = 0 | ||||
| ) -> ChronikResponse: | |||||
| query = f"?checkpoint_height={checkpoint_height}" if checkpoint_height else "" | |||||
Fabien: Otherwise your test is not checking what you expect when checkpoint_height=0. This solution… | |||||
| return self._request_get( | |||||
| f"/block-header/{hash_or_height}{query}", pb.BlockHeader | |||||
| ) | |||||
| def block_headers(self, start_height: int, end_height: int) -> ChronikResponse: | def block_headers( | ||||
| self, start_height: int, end_height: int, checkpoint_height: int = 0 | |||||
FabienUnsubmitted Not Done Inline Actionsdito Fabien: dito | |||||
| ) -> ChronikResponse: | |||||
| query = f"?checkpoint_height={checkpoint_height}" if checkpoint_height else "" | |||||
| return self._request_get( | return self._request_get( | ||||
| f"/block-headers/{start_height}/{end_height}", pb.BlockHeaders | f"/block-headers/{start_height}/{end_height}{query}", pb.BlockHeaders | ||||
| ) | ) | ||||
| def chronik_info(self) -> ChronikResponse: | def chronik_info(self) -> ChronikResponse: | ||||
| return self._request_get("/chronik-info", pb.ChronikInfo) | return self._request_get("/chronik-info", pb.ChronikInfo) | ||||
| def tx(self, txid: str) -> ChronikResponse: | def tx(self, txid: str) -> ChronikResponse: | ||||
| return self._request_get(f"/tx/{txid}", pb.Tx) | return self._request_get(f"/tx/{txid}", pb.Tx) | ||||
| ▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines | |||||
Otherwise your test is not checking what you expect when checkpoint_height=0. This solution lets you try both without query params and with checkpoint_height=0