pytest: remove flake in test_upgrade_statickey_onchaind

We were relying on the fee update to create an additional tx.  That's
ugly; do an actual payment and make sure we definitely complete a new
tx by waiting for that *then* both revoke_and_ack.

(Without this, we could get a unilateral close instead of a penalty).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-01-29 14:03:06 +10:30
parent b47930f395
commit f7f9f35f2a

View File

@@ -3522,8 +3522,21 @@ def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind):
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1')
# Make sure another commitment happens, sending failed payment.
routestep = {
'msatoshi': 1,
'id': l2.info['id'],
'delay': 5,
'channel': '1x1x1' # note: can be bogus for 1-hop direct payments
}
l1.rpc.sendpay([routestep], '00' * 32, payment_secret='00' * 32)
with pytest.raises(RpcError, match=r'WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS'):
l1.rpc.waitsendpay('00' * 32)
# Make sure l2 gets REVOKE_AND_ACK from previous.
l2.daemon.wait_for_log('peer_in WIRE_UPDATE_ADD_HTLC')
l2.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')
l2.daemon.wait_for_log('peer_in WIRE_REVOKE_AND_ACK')
# Pre-statickey penalty works.
bitcoind.rpc.sendrawtransaction(tx)