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

Function test_no_fee_estimate

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

Source from the content-addressed store, hash-verified

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

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