Skip to content

add unit test to show problem with double producing in certain extreme cases

Andrzej Lisak requested to merge abw_witness_double_prod_fix into develop

The problem occurs most often when the following conditions are met:

  • there are multiple nodes in the network (normal) - needed for p2p to work
  • multiple witnesses on the same node (extreme - preferably all top 20) - needed for single producing node to be sending out many fast confirm transactions
  • flood of transactions (extreme) - needed to slow down p2p
block_ctrl.on_end_of_apply_block();
db.notify_finish_push_block( full_block );

The problem shows up when it takes more than 50ms to broadcast fast confirm transactions (and also it needs to take more than 150ms to produce block, but that is pretty easy to achieve). It results from order of executions - first block flow control is notified about finished block processing which in case of witness version triggers promise and allows witness thread to continue (it will immediately reschedule itself for at least 50ms). Then block finalization signal is processed, where witness sends out OBI transactions and then recalculates data for next production slot. When it takes too long to broadcast OBI transactions, witness thread has a chance to wake up before data for new slot is calculated, which means it tries to produce block with old data, but it just produced such block. The only effect is an error in log, block duplicate is not actually produced.

Merge request reports

Loading