@@ -187,8 +187,8 @@ impl LdkLiteBuilder {
187187 }
188188
189189 /// Builds an [`LdkLite`] instance according to the options previously configured.
190- pub fn build ( self ) -> Result < LdkLite , Error > {
191- let config = Arc :: new ( self . config ) ;
190+ pub fn build ( & self ) -> Result < LdkLite , Error > {
191+ let config = Arc :: new ( self . config . clone ( ) ) ;
192192
193193 let ldk_data_dir = format ! ( "{}/ldk" , & config. storage_dir_path. clone( ) ) ;
194194 fs:: create_dir_all ( ldk_data_dir. clone ( ) ) ?;
@@ -583,7 +583,7 @@ impl LdkLite {
583583
584584 /// Blocks until the next event is available.
585585 ///
586- /// Note: this will always return the same event until handling is confirmed via [`event_handled`].
586+ /// Note: this will always return the same event until handling is confirmed via [`LdkLite:: event_handled`].
587587 pub fn next_event ( & self ) -> LdkLiteEvent {
588588 self . event_queue . next_event ( )
589589 }
@@ -731,17 +731,19 @@ impl LdkLite {
731731
732732 /// Send a spontaneous, aka. "keysend", payment
733733 pub fn send_spontaneous_payment (
734- & self , amount_msat : u64 , node_id : PublicKey ,
734+ & self , amount_msat : u64 , node_id : & str ,
735735 ) -> Result < PaymentHash , Error > {
736736 if self . running . read ( ) . unwrap ( ) . is_none ( ) {
737737 return Err ( Error :: NotRunning ) ;
738738 }
739739
740+ let pubkey = hex:: to_compressed_pubkey ( node_id) . ok_or ( Error :: PeerInfoParse ( "failed to parse node id" ) ) ?;
741+
740742 let payment_preimage = PaymentPreimage ( self . keys_manager . get_secure_random_bytes ( ) ) ;
741743 let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
742744
743745 let status = match self . invoice_payer . pay_pubkey (
744- node_id ,
746+ pubkey ,
745747 payment_preimage,
746748 amount_msat,
747749 self . config . default_cltv_expiry_delta ,
0 commit comments