Refactor calculateConsumeBytes into blocksSize.