@@ -2198,6 +2198,36 @@ 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+
2213+ # First line is blinding, then <peerid> then <encblob>.
2214+ blinding , p1 , p1enc , p2 = output .split ('\n ' )
2215+ # First hop can't be blinded!
2216+ assert p1 == l2 .info ['id' ]
2217+
2218+ l1 .rpc .call ('sendonionmessage' ,
2219+ {'hops' :
2220+ [{'id' : l2 .info ['id' ]},
2221+ {'id' : l3 .info ['id' ]}],
2222+ 'reply_path' :
2223+ {'blinding' : blinding ,
2224+ 'path' : [{'id' : p1 , 'enctlv' : p1enc }, {'id' : p2 }]}})
2225+
2226+ assert l3 .daemon .wait_for_log ('Got onionmsg reply_blinding reply_path' )
2227+ assert l3 .daemon .wait_for_log ('Sent reply via' )
2228+ assert l1 .daemon .wait_for_log ('Got onionmsg' )
2229+
2230+
22012231@unittest .skipIf (not DEVELOPER , "needs --dev-force-privkey" )
22022232def test_getsharedsecret (node_factory ):
22032233 """
0 commit comments