diff --git a/tests/test_cln_rs.py b/tests/test_cln_rs.py index de97ec717223..98327e5417e0 100644 --- a/tests/test_cln_rs.py +++ b/tests/test_cln_rs.py @@ -382,3 +382,33 @@ def test_grpc_decode(node_factory): string=inv.bolt11 )) print(res) + + +def test_grpc_notifications(node_factory, bitcoind): + grpc_port = reserve() + l1 = node_factory.get_node(options={"grpc-port" : str(grpc_port)}) + l2 = node_factory.get_node() + + # Test the block_added notification + # Start listening to block added events over grpc + block_added_stream = l1.grpc.SubscribeBlockAdded(clnpb.StreamBlockAddedRequest()) + bitcoind.generate_block(10) + for block_added_event in block_added_stream: + assert block_added_event.hash is not None + assert block_added_event.height is not None + + # If we don't break out of the loop we'll + # be waiting for ever + break + + # Test the connect notification + connect_stream = l1.grpc.SubscribeConnect(clnpb.StreamConnectRequest()) + l2.connect(l1) + + for connect_event in connect_stream: + assert connect_event.id.hex() == l2.info["hex"] + + + + +