@@ -2217,6 +2217,36 @@ def test_sendonionmessage(node_factory):
22172217 assert l3 .daemon .wait_for_log ('Got onionmsg' )
22182218
22192219
2220+ @unittest .skipIf (not EXPERIMENTAL_FEATURES , "Needs sendonionmessage" )
2221+ def test_sendonionmessage_reply (node_factory ):
2222+ blindedpathtool = os .path .join (os .path .dirname (__file__ ), ".." , "devtools" , "blindedpath" )
2223+
2224+ plugin = os .path .join (os .path .dirname (__file__ ), "plugins" , "onionmessage-reply.py" )
2225+ l1 , l2 , l3 = node_factory .line_graph (3 , opts = {'plugin' : plugin })
2226+
2227+ # Make reply path
2228+ output = subprocess .check_output (
2229+ [blindedpathtool , '--simple-output' , 'create' , l2 .info ['id' ], l1 .info ['id' ]]
2230+ ).decode ('ASCII' ).strip ()
2231+
2232+ # First line is blinding, then <peerid> then <encblob>.
2233+ blinding , p1 , p1enc , p2 = output .split ('\n ' )
2234+ # First hop can't be blinded!
2235+ assert p1 == l2 .info ['id' ]
2236+
2237+ l1 .rpc .call ('sendonionmessage' ,
2238+ {'hops' :
2239+ [{'id' : l2 .info ['id' ]},
2240+ {'id' : l3 .info ['id' ]}],
2241+ 'reply_path' :
2242+ {'blinding' : blinding ,
2243+ 'path' : [{'id' : p1 , 'enctlv' : p1enc }, {'id' : p2 }]}})
2244+
2245+ assert l3 .daemon .wait_for_log ('Got onionmsg reply_blinding reply_path' )
2246+ assert l3 .daemon .wait_for_log ('Sent reply via' )
2247+ assert l1 .daemon .wait_for_log ('Got onionmsg' )
2248+
2249+
22202250@unittest .skipIf (not DEVELOPER , "needs --dev-force-privkey" )
22212251def test_getsharedsecret (node_factory ):
22222252 """
0 commit comments