From 2a5a184218f03980cca9fa5e6443681bd21aad04 Mon Sep 17 00:00:00 2001 From: Antony Denyer Date: Tue, 2 Aug 2022 12:35:25 +0100 Subject: [PATCH] Add information about emptyBlockPeriodSeconds --- .../configure/consensus-protocols/qbft.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/configure-and-manage/configure/consensus-protocols/qbft.md b/docs/configure-and-manage/configure/consensus-protocols/qbft.md index 2a54a660..6137c157 100644 --- a/docs/configure-and-manage/configure/consensus-protocols/qbft.md +++ b/docs/configure-and-manage/configure/consensus-protocols/qbft.md @@ -297,3 +297,56 @@ To swap between block header validator selection and contract validator selectio ``` 3. [Restart all nodes](../../../tutorials/private-network/create-qbft-network.md#5-initialize-nodes) in the network using the updated genesis file. + +### Configure Empty Block Period + +A block is produced every block period, whether there are transactions or not. This can lead to your network being bloated with many empty blocks, especially if you have a low block period e.g 1 second. Configuring `emptyBlockPeriodSeconds` aims to solve this by reducing (and optionally eliminating) the number of empty blocks produced in your network. You can specify `emptyBlockPeriodSeconds` using the config section or with a transition. + +Take the following example: + +```bash +"transitions": [{ + "block": ..., + "blockPeriodSeconds": 2 + "emptyBlockPeriodSeconds": 60 +}] +``` + +A block will be produced every two seconds if there are transactions pending to be mined. If no transactions are pending, then no block will be produced for 60 seconds. + +You may end up with something that looks a little like this: + +```yaml +block: 10 +timestamp: 07:00:00 +transactions: 1 + +block: 11 +timestamp: 07:00:02 +transactions: 3 + +block: 12 +timestamp: 07:01:02 +transactions: 0 + +block: 13 +timestamp: 07:02:02 +transactions: 0 + +block: 14 +timestamp: 07:02:08 +transactions: 2 + +block: 15 +timestamp: 07:02:42 +transactions: 1 + +block: 16 +timestamp: 07:03:12 +transactions: 1 + +``` + +!!! Note + + If the `emptyBlockPeriodSeconds` is less than `blockPeriodSeconds` empty blocks will continue to be produced.