def test_transfer_after_connect_works(raiden_network, token_addresses): """ Test that payments work after joining a channel. This makes sure that the connection manager does not leave any partners in a half-healthchecked state that causes problems during payments. Test for https://github.com/raiden-network/raiden/issues/5918 """ registry_address = raiden_network[0].raiden.default_registry.address token_address = token_addresses[0] app0, app1, app2 = raiden_network api0 = RaidenAPI(app0.raiden) api1 = RaidenAPI(app1.raiden) # Open channel between node0 and node2 to not run into the bootstrapping # case when joining the token network api0.channel_open(registry_address, token_address, app2.raiden.address) # Make sure that app1 processed the block where channel open # happened. Otherwise the test becomes flaky because it does not see # potential participants in the network current_block = app0.raiden.get_block_number() wait_for_block(app1.raiden, current_block, 1) api1.token_network_connect( registry_address=registry_address, token_address=token_address, funds=TokenAmount(100), initial_channel_target=2, ) payment_result = api1.transfer_and_wait( registry_address=registry_address, token_address=token_address, amount=PaymentAmount(1), target=app0.raiden.address, ).payment_done.get() assert isinstance(payment_result, EventPaymentSentSuccess)