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

Function test_numeric_msat_notification

tests/test_clnrest.py:412–431  ·  view source on GitHub ↗

Test that msat fields are integers in notifications also.

(node_factory)

Source from the content-addressed store, hash-verified

410
411
412def test_numeric_msat_notification(node_factory):
413 """Test that msat fields are integers in notifications also."""
414 # start a node with clnrest
415 rest_port = str(node_factory.get_unused_port())
416 base_url = 'http://127.0.0.1:' + rest_port
417 l1, l2 = node_factory.get_nodes(2, opts=[{}, {'clnrest-port': rest_port, 'clnrest-protocol': 'http'}])
418 node_factory.join_nodes([l1, l2], wait_for_announce=True)
419 http_session = http_session_with_retry()
420
421 # create an invoice on l2
422 inv = l2.rpc.invoice(5000000, 'test_invoice_payment_notification', 'test_invoice_payment_notification_description')
423
424 # create rune authorizing listclnrest-notifications method
425 rune_clnrest_notifications = l2.rpc.createrune(restrictions=[["method=listclnrest-notifications"]])['rune']
426 http_session.headers.update({"rune": rune_clnrest_notifications})
427 notifications = notifications_received_via_websocket(l1, base_url, http_session, 'pay', [inv['bolt11']])
428 filtered_notifications = [n for n in notifications if 'invoice_payment' in n]
429
430 assert isinstance(filtered_notifications[0]['invoice_payment']['msat'], int)
431 assert filtered_notifications[0]['invoice_payment']['msat'] == 5000000
432
433
434def test_options(node_factory):

Callers

nothing calls this directly

Calls 7

http_session_with_retryFunction · 0.85
get_unused_portMethod · 0.80
get_nodesMethod · 0.80
join_nodesMethod · 0.80
updateMethod · 0.80
invoiceMethod · 0.45

Tested by

no test coverage detected