@@ -50,7 +50,7 @@ use crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParame
50
50
use crate :: ln:: msgs;
51
51
use crate :: ln:: onion_utils;
52
52
use crate :: ln:: onion_utils:: HTLCFailReason ;
53
- use crate :: ln:: msgs:: { ChannelMessageHandler , DecodeError , LightningError , MAX_VALUE_MSAT } ;
53
+ use crate :: ln:: msgs:: { ChannelMessageHandler , DecodeError , LightningError } ;
54
54
#[ cfg( test) ]
55
55
use crate :: ln:: outbound_payment;
56
56
use crate :: ln:: outbound_payment:: { OutboundPayments , PaymentAttempts , PendingOutboundPayment } ;
@@ -6005,37 +6005,6 @@ where
6005
6005
}
6006
6006
}
6007
6007
6008
- fn set_payment_hash_secret_map ( & self , payment_hash : PaymentHash , payment_preimage : Option < PaymentPreimage > , min_value_msat : Option < u64 > , invoice_expiry_delta_secs : u32 ) -> Result < PaymentSecret , APIError > {
6009
- assert ! ( invoice_expiry_delta_secs <= 60 * 60 * 24 * 365 ) ; // Sadly bitcoin timestamps are u32s, so panic before 2106
6010
-
6011
- if min_value_msat. is_some ( ) && min_value_msat. unwrap ( ) > MAX_VALUE_MSAT {
6012
- return Err ( APIError :: APIMisuseError { err : format ! ( "min_value_msat of {} greater than total 21 million bitcoin supply" , min_value_msat. unwrap( ) ) } ) ;
6013
- }
6014
-
6015
- let payment_secret = PaymentSecret ( self . entropy_source . get_secure_random_bytes ( ) ) ;
6016
-
6017
- let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( self ) ;
6018
- let mut payment_secrets = self . pending_inbound_payments . lock ( ) . unwrap ( ) ;
6019
- match payment_secrets. entry ( payment_hash) {
6020
- hash_map:: Entry :: Vacant ( e) => {
6021
- e. insert ( PendingInboundPayment {
6022
- payment_secret, min_value_msat, payment_preimage,
6023
- user_payment_id : 0 , // For compatibility with version 0.0.103 and earlier
6024
- // We assume that highest_seen_timestamp is pretty close to the current time -
6025
- // it's updated when we receive a new block with the maximum time we've seen in
6026
- // a header. It should never be more than two hours in the future.
6027
- // Thus, we add two hours here as a buffer to ensure we absolutely
6028
- // never fail a payment too early.
6029
- // Note that we assume that received blocks have reasonably up-to-date
6030
- // timestamps.
6031
- expiry_time : self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 + invoice_expiry_delta_secs as u64 + 7200 ,
6032
- } ) ;
6033
- } ,
6034
- hash_map:: Entry :: Occupied ( _) => return Err ( APIError :: APIMisuseError { err : "Duplicate payment hash" . to_owned ( ) } ) ,
6035
- }
6036
- Ok ( payment_secret)
6037
- }
6038
-
6039
6008
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
6040
6009
/// to pay us.
6041
6010
///
@@ -6075,23 +6044,6 @@ where
6075
6044
min_final_cltv_expiry_delta)
6076
6045
}
6077
6046
6078
- /// Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
6079
- /// serialized state with LDK node(s) running 0.0.103 and earlier.
6080
- ///
6081
- /// May panic if `invoice_expiry_delta_secs` is greater than one year.
6082
- ///
6083
- /// # Note
6084
- /// This method is deprecated and will be removed soon.
6085
- ///
6086
- /// [`create_inbound_payment`]: Self::create_inbound_payment
6087
- #[ deprecated]
6088
- pub fn create_inbound_payment_legacy ( & self , min_value_msat : Option < u64 > , invoice_expiry_delta_secs : u32 ) -> Result < ( PaymentHash , PaymentSecret ) , APIError > {
6089
- let payment_preimage = PaymentPreimage ( self . entropy_source . get_secure_random_bytes ( ) ) ;
6090
- let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
6091
- let payment_secret = self . set_payment_hash_secret_map ( payment_hash, Some ( payment_preimage) , min_value_msat, invoice_expiry_delta_secs) ?;
6092
- Ok ( ( payment_hash, payment_secret) )
6093
- }
6094
-
6095
6047
/// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
6096
6048
/// stored external to LDK.
6097
6049
///
@@ -6145,20 +6097,6 @@ where
6145
6097
min_final_cltv_expiry)
6146
6098
}
6147
6099
6148
- /// Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
6149
- /// serialized state with LDK node(s) running 0.0.103 and earlier.
6150
- ///
6151
- /// May panic if `invoice_expiry_delta_secs` is greater than one year.
6152
- ///
6153
- /// # Note
6154
- /// This method is deprecated and will be removed soon.
6155
- ///
6156
- /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
6157
- #[ deprecated]
6158
- pub fn create_inbound_payment_for_hash_legacy ( & self , payment_hash : PaymentHash , min_value_msat : Option < u64 > , invoice_expiry_delta_secs : u32 ) -> Result < PaymentSecret , APIError > {
6159
- self . set_payment_hash_secret_map ( payment_hash, None , min_value_msat, invoice_expiry_delta_secs)
6160
- }
6161
-
6162
6100
/// Gets an LDK-generated payment preimage from a payment hash and payment secret that were
6163
6101
/// previously returned from [`create_inbound_payment`].
6164
6102
///
0 commit comments