feerate: allow names 'urgent' 'normal' and 'slow'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-08-29 06:16:34 +09:30
committed by Christian Decker
parent e0952ceff2
commit db3c387264
10 changed files with 63 additions and 17 deletions

View File

@@ -1124,6 +1124,17 @@ def test_no_fee_estimate(node_factory, bitcoind, executor):
with pytest.raises(RpcError, match=r'Cannot estimate fees'):
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all')
# Can't use feerate names, either.
with pytest.raises(RpcError, match=r'Cannot estimate fees'):
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all', 'urgent')
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all', 'normal')
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all', 'slow')
with pytest.raises(RpcError, match=r'Cannot estimate fees'):
l1.rpc.fundchannel(l2.info['id'], 10**6, 'urgent')
l1.rpc.fundchannel(l2.info['id'], 10**6, 'normal')
l1.rpc.fundchannel(l2.info['id'], 10**6, 'slow')
# Can with manual feerate.
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 10000, '1500perkb')
l1.rpc.fundchannel(l2.info['id'], 10**6, '2000perkw')
@@ -1161,12 +1172,12 @@ def test_no_fee_estimate(node_factory, bitcoind, executor):
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.
# Can now fund a channel (as a test, use slow feerate).
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.rpc.fundchannel(l2.info['id'], 10**6)
l1.rpc.fundchannel(l2.info['id'], 10**6, 'slow')
# Can withdraw.
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all')
# Can withdraw (use urgent feerate).
l1.rpc.withdraw(l2.rpc.newaddr()['address'], 'all', 'urgent')
@unittest.skipIf(not DEVELOPER, "needs --dev-disconnect")