pytest: make test_no_fee_estimate more reliable.

1. Wait for a 'sendrawtransaction' *after* the dev-fail message; don't be
   fooled by a previous one.
2. Turning on estimate fee sets fees exactly; just wait for it to be processed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-08-29 10:59:50 +09:30 committed by Christian Decker
parent 33c6285787
commit 7e1fd9c38a

View File

@ -1142,6 +1142,7 @@ def test_no_fee_estimate(node_factory, bitcoind, executor):
# Make sure we clean up cahnnel for later attempt.
l1.daemon.wait_for_log('sendrawtx exit 0')
l1.rpc.dev_fail(l2.info['id'])
l1.daemon.wait_for_log('Failing due to dev-fail command')
l1.daemon.wait_for_log('sendrawtx exit 0')
bitcoind.generate_block(6)
wait_for(lambda: only_one(l1.rpc.getpeer(l2.info['id'])['channels'])['state'] == 'ONCHAIN')
@ -1163,14 +1164,14 @@ def test_no_fee_estimate(node_factory, bitcoind, executor):
l2.fund_channel(l1, 10**6)
l2.pay(l1, 10**9 // 2)
l1.rpc.dev_fail(l2.info['id'])
l1.daemon.wait_for_log('Failing due to dev-fail command')
l1.daemon.wait_for_log('sendrawtx exit 0')
bitcoind.generate_block(5)
l1.daemon.wait_for_log('sendrawtx exit 0')
bitcoind.generate_block(100)
# Restart estimatesmartfee, wait for it to pass 5000
# Start estimatesmartfee.
l1.set_feerates((15000, 7500, 3750), True)
l1.daemon.wait_for_log('Feerate estimate for normal set to [567][0-9]{3}')
# Can now fund a channel (as a test, use slow feerate).
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)