connex
connex copied to clipboard
Getting last block fails
Hi all,
When using:
const lastBlock = await this.connex.thor.block().get();
ocassionaly I get genesis block (height = 0).
Do you know what might be wrong.
if (!this.connex.thor.status.head.number) {
await this.connex.thor.ticker().next()
}
const lastBlock = await this.connex.thor.block().get()
add lines to check the head number should work
Have you considered including that check in the block()
function?
this.connex.thor.status.head.number
should never be null
or undefined
...
await this.connex.thor.block().get()
sometimes returns null. That is the same issue, isn't it?
Have you considered including that check in the
block()
function?this.connex.thor.status.head.number
should never benull
orundefined
...await this.connex.thor.block().get()
sometimes returns null. That is the same issue, isn't it?
await this.connex.thor.block().get()
returns null only if the block specified by the given arg revision
does not exists.
If you do not provide any argument to the block()
function, await this.connex.thor.block().get()
should return the head block, so it should never be null
and it sometimes is. That looks like a bug to me.
Same as this.connex.thor.status.head.number
being null
.
If you do not provide any argument to the
block()
function,await this.connex.thor.block().get()
should return the head block, so it should never benull
and it sometimes is. That looks like a bug to me. Same asthis.connex.thor.status.head.number
beingnull
.
You're right. I'll look into the code. Can you provides some context of your code piece?
I am basically scanning blocks and once in a while await this.connex.thor.block().get()
returns null
.