@@ -303,27 +303,7 @@ def test_grpc_keysend_routehint(bitcoind, node_factory):
303303 bitcoind .generate_block (3 )
304304 sync_blockheight (bitcoind , [l1 , l2 , l3 ])
305305
306- def connect (node ):
307- p = Path (node .daemon .lightning_dir ) / TEST_NETWORK
308- cert , key , ca = [f .open ('rb' ).read () for f in [
309- p / 'client.pem' ,
310- p / 'client-key.pem' ,
311- p / "ca.pem" ]]
312-
313- creds = grpc .ssl_channel_credentials (
314- root_certificates = ca ,
315- private_key = key ,
316- certificate_chain = cert ,
317- )
318-
319- channel = grpc .secure_channel (
320- f"localhost:{ grpc_port } " ,
321- creds ,
322- options = (('grpc.ssl_target_name_override' , 'cln' ),)
323- )
324- return nodegrpc .NodeStub (channel )
325-
326- stub = connect (l1 )
306+ stub = l1 .grpc
327307 chan = l2 .rpc .listpeerchannels (l3 .info ['id' ])
328308
329309 routehint = primitivespb .RoutehintList (hints = [
@@ -362,26 +342,7 @@ def test_grpc_listpeerchannels(bitcoind, node_factory):
362342 announce_channels = True , # Do not enforce scid-alias
363343 )
364344
365- def connect (node ):
366- p = Path (node .daemon .lightning_dir ) / TEST_NETWORK
367- cert , key , ca = [f .open ('rb' ).read () for f in [
368- p / 'client.pem' ,
369- p / 'client-key.pem' ,
370- p / "ca.pem" ]]
371-
372- creds = grpc .ssl_channel_credentials (
373- root_certificates = ca ,
374- private_key = key ,
375- certificate_chain = cert ,
376- )
377-
378- channel = grpc .secure_channel (
379- f"localhost:{ grpc_port } " ,
380- creds ,
381- options = (('grpc.ssl_target_name_override' , 'cln' ),)
382- )
383- return nodegrpc .NodeStub (channel )
384- stub = connect (l1 )
345+ stub = l1 .grpc
385346 res = stub .ListPeerChannels (nodepb .ListpeerchannelsRequest (id = None ))
386347
387348 # Way too many fields to check, so just do a couple
@@ -399,3 +360,24 @@ def connect(node):
399360 l1 .daemon .wait_for_log (r'onchaind complete, forgetting peer' )
400361
401362 stub .ListClosedChannels (nodepb .ListclosedchannelsRequest ())
363+
364+
365+ def test_grpc_decode (node_factory ):
366+ grpc_port = reserve ()
367+ l1 = node_factory .get_node (options = {'grpc-port' : str (grpc_port )})
368+ inv = l1 .grpc .Invoice (nodepb .InvoiceRequest (
369+ amount_msat = primitivespb .AmountOrAny (any = True ),
370+ description = "desc" ,
371+ label = "label" ,
372+ ))
373+
374+ res = l1 .grpc .DecodePay (nodepb .DecodepayRequest (
375+ bolt11 = inv .bolt11
376+ ))
377+ # If we get here we're good, conversions work
378+ print (res )
379+
380+ res = l1 .grpc .Decode (nodepb .DecodeRequest (
381+ string = inv .bolt11
382+ ))
383+ print (res )
0 commit comments