def test_view_change_with_unaligned_prepare_certificates_on_half_nodes(
        txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client, tconf):
    """
    Perform view change with half nodes reaching lower last prepared certificate than others.
    With current implementation of view change this can result with view change taking a lot of time.
    """
    do_view_change_with_unaligned_prepare_certificates(txnPoolNodeSet[2:],
                                                       txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client)

    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)
def test_view_change_with_unaligned_prepare_certificates_on_half_nodes(
        txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client, tconf):
    """
    Perform view change with half nodes reaching lower last prepared certificate than others.
    With current implementation of view change this can result with view change taking a lot of time.
    """
    do_view_change_with_unaligned_prepare_certificates(txnPoolNodeSet[2:],
                                                       txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client)

    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)
def test_view_change_with_unaligned_prepare_certificates_on_one_node(
        txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client, tconf):
    """
    Perform view change with only one node reaching lower last prepared certificate than others.
    """
    do_view_change_with_unaligned_prepare_certificates(txnPoolNodeSet[3:],
                                                       txnPoolNodeSet, looper,
                                                       sdk_pool_handle,
                                                       sdk_wallet_client)

    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)
def test_view_change_with_unaligned_prepare_certificates_on_one_node(
        txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client, tconf):
    """
    Perform view change with only one node reaching lower last prepared certificate than others.
    This is to ensure that despite setting MIN_TIMEOUT_CATCHUPS_DONE_DURING_VIEW_CHANGE high view change
    can finish early in optimistic scenarios.
    """
    do_view_change_with_unaligned_prepare_certificates(txnPoolNodeSet[3:],
                                                       txnPoolNodeSet, looper,
                                                       sdk_pool_handle,
                                                       sdk_wallet_client)

    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)