(node_factory, bitcoind)
| 2380 | |
| 2381 | @pytest.mark.developer |
| 2382 | def test_fee_limits(node_factory, bitcoind): |
| 2383 | l1, l2, l3, l4 = node_factory.get_nodes(4, opts=[{'dev-max-fee-multiplier': 5, 'may_reconnect': True, |
| 2384 | 'allow_warning': True}, |
| 2385 | {'dev-max-fee-multiplier': 5, 'may_reconnect': True, |
| 2386 | 'allow_warning': True}, |
| 2387 | {'ignore-fee-limits': True, 'may_reconnect': True}, |
| 2388 | {}]) |
| 2389 | |
| 2390 | node_factory.join_nodes([l1, l2], fundchannel=True) |
| 2391 | |
| 2392 | # Kick off fee adjustment using HTLC. |
| 2393 | l1.pay(l2, 1000) |
| 2394 | |
| 2395 | # L1 asks for stupid low fee (will actually hit the floor of 253) |
| 2396 | l1.stop() |
| 2397 | l1.set_feerates((15, 15, 15, 15), False) |
| 2398 | l1.start() |
| 2399 | |
| 2400 | l1.daemon.wait_for_log('Peer transient failure in CHANNELD_NORMAL: channeld WARNING: .*: update_fee 253 outside range 1875-75000') |
| 2401 | |
| 2402 | # Closes, but does not error. Make sure it's noted in their status though. |
| 2403 | assert 'update_fee 253 outside range 1875-75000' in only_one(only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels'])['status'][0] |
| 2404 | assert 'update_fee 253 outside range 1875-75000' in only_one(only_one(l2.rpc.listpeers(l1.info['id'])['peers'])['channels'])['status'][0] |
| 2405 | |
| 2406 | # Make l2 accept those fees, and it should recover. |
| 2407 | l2.stop() |
| 2408 | l2.set_feerates((15, 15, 15, 15), False) |
| 2409 | l2.start() |
| 2410 | |
| 2411 | l1.rpc.close(l2.info['id']) |
| 2412 | |
| 2413 | # Make sure the resolution of this one doesn't interfere with the next! |
| 2414 | # Note: may succeed, may fail with insufficient fee, depending on how |
| 2415 | # bitcoind feels! |
| 2416 | l2.daemon.wait_for_log('sendrawtx exit') |
| 2417 | bitcoind.generate_block(1) |
| 2418 | sync_blockheight(bitcoind, [l1, l2]) |
| 2419 | |
| 2420 | # Trying to open a channel with too low a fee-rate is denied |
| 2421 | l1.rpc.connect(l4.info['id'], 'localhost', l4.port) |
| 2422 | with pytest.raises(RpcError, match='They sent error .* feerate_per_kw 253 below minimum'): |
| 2423 | l1.fundchannel(l4, 10**6) |
| 2424 | |
| 2425 | # Restore to normal. |
| 2426 | l1.stop() |
| 2427 | l1.set_feerates((15000, 11000, 7500, 3750), False) |
| 2428 | l1.start() |
| 2429 | |
| 2430 | # Try with node which sets --ignore-fee-limits |
| 2431 | l1.rpc.connect(l3.info['id'], 'localhost', l3.port) |
| 2432 | chan, _ = l1.fundchannel(l3, 10**6) |
| 2433 | |
| 2434 | # Kick off fee adjustment using HTLC. |
| 2435 | l1.pay(l3, 1000) |
| 2436 | |
| 2437 | # Try stupid high fees |
| 2438 | l1.stop() |
| 2439 | l1.set_feerates((15000, 11000 * 10, 7500, 3750), False) |
nothing calls this directly
no test coverage detected