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

Function test_numeric_msat_notification

tests/test_clnrest.py:410–429  ·  view source on GitHub ↗

Test that msat fields are integers in notifications also.

(node_factory)

Source from the content-addressed store, hash-verified

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