const getBlocksListener = async () => {
const stream = await Torii.listenForBlocksStream(pre, {
// 1 is genesis block, which is committed before each test
height: 0n,
});
return {
/**
* Do an operation that should trigger a block commit,
* and wait until the block is emitted
*/
awaitBlockCommit: async (fn) => {
await Promise.all([stream.ee.once('block'), fn()]);
},
};
};
await blocks.awaitBlockCommit(async () => {
await client.submitExecutable(pre, exec);
});
This code results in a cryptic error message:
iroha::torii::routing: Failed to subscribe to blocks stream error=Error during versioned message decoding
This happens because the code uses 0 instead of 1 to get the genesis block. Inside listenForBlocksStream we should check that the given height is in bounds before sending the request to the node
This code results in a cryptic error message:
This happens because the code uses 0 instead of 1 to get the genesis block. Inside
listenForBlocksStream
we should check that the givenheight
is in bounds before sending the request to the node