@@ -1322,6 +1322,29 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1322
1322
self . send_payment_probe_internal ( route_params)
1323
1323
}
1324
1324
1325
+ /// Sends payment probes over all paths of a route that would be used to pay the given
1326
+ /// amount to the given `node_id`.
1327
+ ///
1328
+ /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting
1329
+ /// the actual payment. Note this is only useful if there likely is sufficient time for the
1330
+ /// probe to settle before sending out the actual payment, e.g., when waiting for user
1331
+ /// confirmation in a wallet UI.
1332
+ pub fn send_spontaneous_payment_probe (
1333
+ & self , amount_msat : u64 , node_id : PublicKey ,
1334
+ ) -> Result < ( ) , Error > {
1335
+ let rt_lock = self . runtime . read ( ) . unwrap ( ) ;
1336
+ if rt_lock. is_none ( ) {
1337
+ return Err ( Error :: NotRunning ) ;
1338
+ }
1339
+
1340
+ let payment_params =
1341
+ PaymentParameters :: from_node_id ( node_id, self . config . default_cltv_expiry_delta ) ;
1342
+
1343
+ let route_params = RouteParameters { payment_params, final_value_msat : amount_msat } ;
1344
+
1345
+ self . send_payment_probe_internal ( route_params)
1346
+ }
1347
+
1325
1348
fn send_payment_probe_internal ( & self , route_params : RouteParameters ) -> Result < ( ) , Error > {
1326
1349
let payer = self . channel_manager . get_our_node_id ( ) ;
1327
1350
let first_hops = self . channel_manager . list_usable_channels ( ) ;
0 commit comments