Skip to content

Commit e1e476f

Browse files
committed
pytest: mark test_rbf_reconnect_tx_construct flaky:
Doesn't always die messily, it seems? ``` @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') @pytest.mark.openchannel('v2') def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams): disconnects = ['=WIRE_TX_ADD_INPUT', # Initial funding succeeds '-WIRE_TX_ADD_INPUT', '+WIRE_TX_ADD_INPUT', '-WIRE_TX_ADD_OUTPUT', '+WIRE_TX_ADD_OUTPUT', '-WIRE_TX_COMPLETE', '+WIRE_TX_COMPLETE', '-WIRE_COMMITMENT_SIGNED', '+WIRE_COMMITMENT_SIGNED'] l1, l2 = node_factory.get_nodes(2, opts=[{'disconnect': disconnects, 'may_reconnect': True, 'dev-no-reconnect': None}, {'may_reconnect': True, 'dev-no-reconnect': None, 'broken_log': 'dualopend daemon died before signed PSBT returned'}]) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) amount = 2**24 chan_amount = 100000 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'], amount / 10**8 + 0.01) bitcoind.generate_block(1) # Wait for it to arrive. wait_for(lambda: len(l1.rpc.listfunds()['outputs']) > 0) res = l1.rpc.fundchannel(l2.info['id'], chan_amount) chan_id = res['channel_id'] vins = bitcoind.rpc.decoderawtransaction(res['tx'])['vin'] assert(only_one(vins)) prev_utxos = ["{}:{}".format(vins[0]['txid'], vins[0]['vout'])] # Check that we're waiting for lockin l1.daemon.wait_for_log(' to DUALOPEND_AWAITING_LOCKIN') # rbf the lease with a higher amount rate = int(find_next_feerate(l1, l2)[:-5]) # We 4x the feerate to beat the min-relay fee next_feerate = '{}perkw'.format(rate * 4) # Initiate an RBF startweight = 42 + 172 # base weight, funding output initpsbt = l1.rpc.utxopsbt(chan_amount, next_feerate, startweight, prev_utxos, reservedok=True, excess_as_change=True) # Run through TX_ADD wires for d in disconnects[1:-4]: l1.rpc.connect(l2.info['id'], 'localhost', l2.port) with pytest.raises(RpcError): l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False) # The first TX_COMPLETE breaks l1.rpc.connect(l2.info['id'], 'localhost', l2.port) bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) with pytest.raises(RpcError): update = l1.rpc.openchannel_update(chan_id, bump['psbt']) wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) # l1 should remember, l2 has forgotten # l2 should send tx-abort, to reset l2.daemon.wait_for_log(r'tx-abort: Sent next_funding_txid .* doesn\'t match ours .*') l1.daemon.wait_for_log(r'Cleaned up incomplete inflight') # abort doesn't cause a disconnect assert l1.rpc.getpeer(l2.info['id'])['connected'] # The next TX_COMPLETE break (both remember) + they break on the # COMMITMENT_SIGNED during the reconnect bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) with pytest.raises(RpcError): update = l1.rpc.openchannel_update(chan_id, bump['psbt']) wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'] is False) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l2.daemon.wait_for_logs([r'Got dualopend reestablish', r'No commitment, not sending our sigs']) l1.daemon.wait_for_logs([r'Got dualopend reestablish', r'No commitment, not sending our sigs', r'dev_disconnect: -WIRE_COMMITMENT_SIGNED', 'peer_disconnect_done']) assert not l1.rpc.getpeer(l2.info['id'])['connected'] l1.rpc.connect(l2.info['id'], 'localhost', l2.port) # COMMITMENT_SIGNED disconnects *during* the reconnect # We can't bump because the last negotiation is in the wrong state with pytest.raises(RpcError, match=r'Funding sigs for this channel not secured'): l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt']) # l2 reconnects, but doesn't have l1's commitment > l2.daemon.wait_for_logs([r'Got dualopend reestablish', r'No commitment, not sending our sigs', # This is a BROKEN log, it's expected! r'dualopend daemon died before signed PSBT returned']) tests/test_opening.py:944: ... > raise TimeoutError('Unable to find "{}" in logs.'.format(exs)) E TimeoutError: Unable to find "[re.compile('dualopend daemon died before signed PSBT returned')]" in logs. ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 21cd118 commit e1e476f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/test_opening.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ def test_rbf_reconnect_tx_construct(node_factory, bitcoind, chainparams):
944944
l2.daemon.wait_for_logs([r'Got dualopend reestablish',
945945
r'No commitment, not sending our sigs',
946946
# This is a BROKEN log, it's expected!
947-
r'dualopend daemon died before signed PSBT returned'])
947+
r'dualopend daemon died before signed PSBT returned|dualopend: Owning subdaemon dualopend died'])
948948

949949
# We don't have the commtiments yet, there's no scratch_txid
950950
inflights = only_one(l1.rpc.listpeerchannels()['channels'])['inflight']

0 commit comments

Comments
 (0)