(node_factory, bitcoind)
| 2453 | |
| 2454 | @pytest.mark.developer("needs dev-no-fake-fees") |
| 2455 | def test_update_fee_dynamic(node_factory, bitcoind): |
| 2456 | # l1 has no fee estimates to start. |
| 2457 | l1 = node_factory.get_node(options={'log-level': 'io', |
| 2458 | 'dev-no-fake-fees': True}, start=False) |
| 2459 | l1.daemon.rpcproxy.mock_rpc('estimatesmartfee', { |
| 2460 | 'error': {"errors": ["Insufficient data or no feerate found"], "blocks": 0} |
| 2461 | }) |
| 2462 | l1.start() |
| 2463 | l2 = node_factory.get_node() |
| 2464 | |
| 2465 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 2466 | # Fails due to lack of fee estimate. |
| 2467 | with pytest.raises(RpcError, match='Cannot estimate fees'): |
| 2468 | l1.fundchannel(l2, 10**6) |
| 2469 | |
| 2470 | # Explicit feerate works. |
| 2471 | l1.fundchannel(l2, 10**6, feerate='10000perkw') |
| 2472 | |
| 2473 | l1.set_feerates((15000, 11000, 7500, 3750)) |
| 2474 | |
| 2475 | # It will send UPDATE_FEE when it tries to send HTLC. |
| 2476 | inv = l2.rpc.invoice(5000, 'test_update_fee_dynamic', 'test_update_fee_dynamic')['bolt11'] |
| 2477 | l1.rpc.pay(inv) |
| 2478 | |
| 2479 | l2.daemon.wait_for_log('peer_in.*UPDATE_FEE') |
| 2480 | |
| 2481 | # Now we take it away again! |
| 2482 | l1.daemon.rpcproxy.mock_rpc('estimatesmartfee', { |
| 2483 | 'error': {"errors": ["Insufficient data or no feerate found"], "blocks": 0} |
| 2484 | }) |
| 2485 | # Make sure that registers! (DEVELOPER means polling every second) |
| 2486 | time.sleep(2) |
| 2487 | |
| 2488 | inv = l2.rpc.invoice(5000, 'test_update_fee_dynamic2', 'test_update_fee_dynamic2')['bolt11'] |
| 2489 | l1.rpc.pay(inv) |
| 2490 | |
| 2491 | # Won't update fee. |
| 2492 | assert not l2.daemon.is_in_log('peer_in.*UPDATE_FEE', |
| 2493 | start=l2.daemon.logsearch_start) |
| 2494 | |
| 2495 | # Bring it back. |
| 2496 | l1.set_feerates((14000, 10000, 7000, 3000)) |
| 2497 | |
| 2498 | # It will send UPDATE_FEE when it tries to send HTLC. |
| 2499 | inv = l2.rpc.invoice(5000, 'test_update_fee_dynamic3', 'test_update_fee_dynamic')['bolt11'] |
| 2500 | l1.rpc.pay(inv) |
| 2501 | |
| 2502 | l2.daemon.wait_for_log('peer_in.*UPDATE_FEE') |
| 2503 | |
| 2504 | |
| 2505 | @pytest.mark.developer |
nothing calls this directly
no test coverage detected