0

How can I query the length of a block used for normal transactions?

After seeing check_block_length, I would have expected to be able to use allExtrinsicsLen, but this always returns None, even if the block contains transactions. Is that expected behavior?

1 Answer 1

4

AllExtrinsicsLen is one of the temporary environment storage entries that are only used in the block-building, not needed for the processing of subsequent blocks and therefore cleared in the finalize step.

The specific entry is cleared here.

Only some environment variables survive to be cleared at the start of the next block, they are listed here. The basics of this is that if something is not needed for the processing of future blocks, they just add bloat to the state, so are not committed.

If you wish to get the length of all extrinsic in a block, the best approach is to read the block and add up all the individual extrinsic lengths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.