@@ -50,7 +50,7 @@ use crate::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringFeeParame
5050use crate :: ln:: msgs;
5151use crate :: ln:: onion_utils;
5252use crate :: ln:: onion_utils:: HTLCFailReason ;
53- use crate :: ln:: msgs:: { ChannelMessageHandler , DecodeError , LightningError , MAX_VALUE_MSAT } ;
53+ use crate :: ln:: msgs:: { ChannelMessageHandler , DecodeError , LightningError } ;
5454#[ cfg( test) ]
5555use crate :: ln:: outbound_payment;
5656use crate :: ln:: outbound_payment:: { OutboundPayments , PaymentAttempts , PendingOutboundPayment } ;
@@ -5874,37 +5874,6 @@ where
58745874 }
58755875 }
58765876
5877- 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 > {
5878- assert ! ( invoice_expiry_delta_secs <= 60 * 60 * 24 * 365 ) ; // Sadly bitcoin timestamps are u32s, so panic before 2106
5879-
5880- if min_value_msat. is_some ( ) && min_value_msat. unwrap ( ) > MAX_VALUE_MSAT {
5881- return Err ( APIError :: APIMisuseError { err : format ! ( "min_value_msat of {} greater than total 21 million bitcoin supply" , min_value_msat. unwrap( ) ) } ) ;
5882- }
5883-
5884- let payment_secret = PaymentSecret ( self . entropy_source . get_secure_random_bytes ( ) ) ;
5885-
5886- let _persistence_guard = PersistenceNotifierGuard :: notify_on_drop ( self ) ;
5887- let mut payment_secrets = self . pending_inbound_payments . lock ( ) . unwrap ( ) ;
5888- match payment_secrets. entry ( payment_hash) {
5889- hash_map:: Entry :: Vacant ( e) => {
5890- e. insert ( PendingInboundPayment {
5891- payment_secret, min_value_msat, payment_preimage,
5892- user_payment_id : 0 , // For compatibility with version 0.0.103 and earlier
5893- // We assume that highest_seen_timestamp is pretty close to the current time -
5894- // it's updated when we receive a new block with the maximum time we've seen in
5895- // a header. It should never be more than two hours in the future.
5896- // Thus, we add two hours here as a buffer to ensure we absolutely
5897- // never fail a payment too early.
5898- // Note that we assume that received blocks have reasonably up-to-date
5899- // timestamps.
5900- expiry_time : self . highest_seen_timestamp . load ( Ordering :: Acquire ) as u64 + invoice_expiry_delta_secs as u64 + 7200 ,
5901- } ) ;
5902- } ,
5903- hash_map:: Entry :: Occupied ( _) => return Err ( APIError :: APIMisuseError { err : "Duplicate payment hash" . to_owned ( ) } ) ,
5904- }
5905- Ok ( payment_secret)
5906- }
5907-
59085877 /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
59095878 /// to pay us.
59105879 ///
@@ -5944,23 +5913,6 @@ where
59445913 min_final_cltv_expiry_delta)
59455914 }
59465915
5947- /// Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
5948- /// serialized state with LDK node(s) running 0.0.103 and earlier.
5949- ///
5950- /// May panic if `invoice_expiry_delta_secs` is greater than one year.
5951- ///
5952- /// # Note
5953- /// This method is deprecated and will be removed soon.
5954- ///
5955- /// [`create_inbound_payment`]: Self::create_inbound_payment
5956- #[ deprecated]
5957- pub fn create_inbound_payment_legacy ( & self , min_value_msat : Option < u64 > , invoice_expiry_delta_secs : u32 ) -> Result < ( PaymentHash , PaymentSecret ) , APIError > {
5958- let payment_preimage = PaymentPreimage ( self . entropy_source . get_secure_random_bytes ( ) ) ;
5959- let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
5960- let payment_secret = self . set_payment_hash_secret_map ( payment_hash, Some ( payment_preimage) , min_value_msat, invoice_expiry_delta_secs) ?;
5961- Ok ( ( payment_hash, payment_secret) )
5962- }
5963-
59645916 /// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
59655917 /// stored external to LDK.
59665918 ///
@@ -6014,20 +5966,6 @@ where
60145966 min_final_cltv_expiry)
60155967 }
60165968
6017- /// Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
6018- /// serialized state with LDK node(s) running 0.0.103 and earlier.
6019- ///
6020- /// May panic if `invoice_expiry_delta_secs` is greater than one year.
6021- ///
6022- /// # Note
6023- /// This method is deprecated and will be removed soon.
6024- ///
6025- /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
6026- #[ deprecated]
6027- 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 > {
6028- self . set_payment_hash_secret_map ( payment_hash, None , min_value_msat, invoice_expiry_delta_secs)
6029- }
6030-
60315969 /// Gets an LDK-generated payment preimage from a payment hash and payment secret that were
60325970 /// previously returned from [`create_inbound_payment`].
60335971 ///
0 commit comments