@@ -2198,6 +2198,37 @@ def test_sendonionmessage(node_factory):
21982198 assert l3 .daemon .wait_for_log ('Got onionmsg' )
21992199
22002200
2201+ @unittest .skipIf (not EXPERIMENTAL_FEATURES , "Needs sendonionmessage" )
2202+ def test_sendonionmessage_reply (node_factory ):
2203+ blindedpathtool = os .path .join (os .path .dirname (__file__ ), ".." , "devtools" , "blindedpath" )
2204+
2205+ plugin = os .path .join (os .path .dirname (__file__ ), "plugins" , "onionmessage-reply.py" )
2206+ l1 , l2 , l3 = node_factory .line_graph (3 , opts = {'plugin' : plugin })
2207+
2208+ # Make reply path
2209+ output = subprocess .check_output (
2210+ [blindedpathtool , '--simple-output' , 'create' , l2 .info ['id' ], l1 .info ['id' ]]
2211+ ).decode ('ASCII' ).strip ()
2212+ print (output )
2213+
2214+ # First line is blinding, then <peerid> then <encblob>.
2215+ blinding , p1 , p1enc , p2 = output .split ('\n ' )
2216+ # First hop can't be blinded!
2217+ assert p1 == l2 .info ['id' ]
2218+
2219+ l1 .rpc .call ('sendonionmessage' ,
2220+ {'hops' :
2221+ [{'id' : l2 .info ['id' ]},
2222+ {'id' : l3 .info ['id' ]}],
2223+ 'reply_path' :
2224+ {'blinding' : blinding ,
2225+ 'path' : [{'id' : p1 , 'enctlv' : p1enc }, {'id' : p2 }]}})
2226+
2227+ assert l3 .daemon .wait_for_log ('Got onionmsg reply_blinding reply_path' )
2228+ assert l3 .daemon .wait_for_log ('Sent reply via' )
2229+ assert l1 .daemon .wait_for_log ('Got onionmsg' )
2230+
2231+
22012232@unittest .skipIf (not DEVELOPER , "needs --dev-force-privkey" )
22022233def test_getsharedsecret (node_factory ):
22032234 """
0 commit comments