MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_no_fee_estimate

Function test_no_fee_estimate

tests/test_connection.py:2923–3009  ·  view source on GitHub ↗
(node_factory, bitcoind, executor)

Source from the content-addressed store, hash-verified

2921
2922
2923def test_no_fee_estimate(node_factory, bitcoind, executor):
2924 l1 = node_factory.get_node(start=False, options={'dev-no-fake-fees': True},
2925 may_reconnect=True)
2926
2927 # Fail any fee estimation requests until we allow them further down
2928 l1.daemon.rpcproxy.mock_rpc('estimatesmartfee', {
2929 'error': {"errors": ["Insufficient data or no feerate found"], "blocks": 0}
2930 })
2931 l1.start()
2932
2933 l2 = node_factory.get_node(may_reconnect=True)
2934 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2935
2936 # Can't fund a channel.
2937 l1.fundwallet(10**7)
2938 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2939 l1.rpc.fundchannel(l2.info['id'], 10**6)
2940
2941 # Can't withdraw either.
2942 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2943 l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all')
2944
2945 # Can't use feerate names, either.
2946 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2947 l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all', 'urgent')
2948
2949 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2950 l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all', 'normal')
2951
2952 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2953 l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all', 'slow')
2954
2955 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2956 l1.rpc.fundchannel(l2.info['id'], 10**6, 'urgent')
2957
2958 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2959 l1.rpc.fundchannel(l2.info['id'], 10**6, 'normal')
2960
2961 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2962 l1.rpc.fundchannel(l2.info['id'], 10**6, 'slow')
2963
2964 # With anchors, not even with manual feerate!
2965 l1.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 10000, '1500perkb')
2966 if TEST_NETWORK == 'regtest':
2967 with pytest.raises(RpcError, match=r'Cannot estimate fees'):
2968 l1.rpc.fundchannel(l2.info['id'], 10**6, '2000perkw', minconf=0)
2969
2970 # Can accept incoming connections, can't allow incoming channels
2971 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2972 with pytest.raises(RpcError, match=r'feerates unknown'):
2973 l2.fundchannel(l1, 10**6)
2974
2975 # Re-enable fees for a moment so we can fund channel.
2976 l1.set_feerates((15000, 11000, 7500, 3750), True)
2977 l2.fundchannel(l1, 10**6)
2978 l1.daemon.rpcproxy.mock_rpc('estimatesmartfee', {
2979 'error': {"errors": ["Insufficient data or no feerate found"], "blocks": 0}
2980 })

Callers

nothing calls this directly

Calls 15

wait_forFunction · 0.90
sync_blockheightFunction · 0.90
mock_rpcMethod · 0.80
fundwalletMethod · 0.80
set_feeratesMethod · 0.80
restartMethod · 0.80
generate_blockMethod · 0.80
dev_failMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected