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

Function test_feerate_spam

tests/test_connection.py:3470–3501  ·  view source on GitHub ↗
(node_factory, chainparams)

Source from the content-addressed store, hash-verified

3468
3469@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Fees on elements are different")
3470def test_feerate_spam(node_factory, chainparams):
3471 l1, l2 = node_factory.line_graph(2)
3472
3473 # We constrain the value the opener has at its disposal so we get the
3474 # REMOTE feerate we are looking for below. This may be fragile and depends
3475 # on the transactions we generate.
3476 slack = 45000000
3477
3478 # Pay almost everything to l2.
3479 l1.pay(l2, 10**9 - slack)
3480
3481 # It will send this once (may have happened before line_graph's wait)
3482 if 'anchors/even' in only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['names']:
3483 wait_for(lambda: l1.daemon.is_in_log('Setting REMOTE feerate to 3755'))
3484 else:
3485 wait_for(lambda: l1.daemon.is_in_log('Setting REMOTE feerate to 11005'))
3486 wait_for(lambda: l1.daemon.is_in_log('peer_out WIRE_UPDATE_FEE'))
3487
3488 # Now change feerates to something l1 can't afford.
3489 l1.set_feerates((200000, 200000, 200000, 200000))
3490
3491 # It will raise as far as it can (30551)
3492 if 'anchors/even' in only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['names']:
3493 maxfeerate = 30551
3494 else:
3495 maxfeerate = 48000
3496 l1.daemon.wait_for_log('Setting REMOTE feerate to {}'.format(maxfeerate))
3497 l1.daemon.wait_for_log('peer_out WIRE_UPDATE_FEE')
3498
3499 # But it won't do it again once it's at max.
3500 with pytest.raises(TimeoutError):
3501 l1.daemon.wait_for_log('peer_out WIRE_UPDATE_FEE', timeout=5)
3502
3503
3504def test_feerate_stress(node_factory, executor):

Callers

nothing calls this directly

Calls 8

only_oneFunction · 0.90
wait_forFunction · 0.90
line_graphMethod · 0.80
listpeerchannelsMethod · 0.80
is_in_logMethod · 0.80
set_feeratesMethod · 0.80
wait_for_logMethod · 0.80
payMethod · 0.45

Tested by

no test coverage detected