@@ -187,8 +187,8 @@ impl LdkLiteBuilder {
187
187
}
188
188
189
189
/// 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 ( ) ) ;
192
192
193
193
let ldk_data_dir = format ! ( "{}/ldk" , & config. storage_dir_path. clone( ) ) ;
194
194
fs:: create_dir_all ( ldk_data_dir. clone ( ) ) ?;
@@ -583,7 +583,7 @@ impl LdkLite {
583
583
584
584
/// Blocks until the next event is available.
585
585
///
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`].
587
587
pub fn next_event ( & self ) -> LdkLiteEvent {
588
588
self . event_queue . next_event ( )
589
589
}
@@ -731,17 +731,19 @@ impl LdkLite {
731
731
732
732
/// Send a spontaneous, aka. "keysend", payment
733
733
pub fn send_spontaneous_payment (
734
- & self , amount_msat : u64 , node_id : PublicKey ,
734
+ & self , amount_msat : u64 , node_id : & str ,
735
735
) -> Result < PaymentHash , Error > {
736
736
if self . running . read ( ) . unwrap ( ) . is_none ( ) {
737
737
return Err ( Error :: NotRunning ) ;
738
738
}
739
739
740
+ let pubkey = hex:: to_compressed_pubkey ( node_id) . ok_or ( Error :: PeerInfoParse ( "failed to parse node id" ) ) ?;
741
+
740
742
let payment_preimage = PaymentPreimage ( self . keys_manager . get_secure_random_bytes ( ) ) ;
741
743
let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
742
744
743
745
let status = match self . invoice_payer . pay_pubkey (
744
- node_id ,
746
+ pubkey ,
745
747
payment_preimage,
746
748
amount_msat,
747
749
self . config . default_cltv_expiry_delta ,
0 commit comments