Try non-websocket header query, leave commented out example

This commit is contained in:
Ethan Frey
2020-08-18 12:48:37 +02:00
committed by Simon Warta
parent 305e36cbd9
commit d0db9c79ed
+5 -1
View File
@@ -227,8 +227,12 @@ export class QueryClient {
if (height == 0) {
throw new Error("Query returned height 0, cannot prove it");
}
// get the header for height+1
// get the header for height+1 with events
const header = await firstEvent(this.tmClient.subscribeNewBlockHeader());
// alternate non-websocket query (fails with error as it is the future)
// const header = (await this.tmClient.blockchain(height+1, height+1)).blockMetas[0].header;
if (header.height !== height + 1) {
throw new Error(`Query returned height ${height}, but next header was ${header.height}`);
}