@@ -32,9 +32,10 @@ use core::time::Duration;
3232/// with the same [`PaymentHash`] is never sent.
3333///
3434/// If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
35- pub fn pay_invoice < C : AChannelManager > (
36- invoice : & Bolt11Invoice , retry_strategy : Retry , channelmanager : & C
35+ pub fn pay_invoice < C : Deref > (
36+ invoice : & Bolt11Invoice , retry_strategy : Retry , channelmanager : C
3737) -> Result < PaymentId , PaymentError >
38+ where C :: Target : AChannelManager ,
3839{
3940 let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
4041 pay_invoice_with_id ( invoice, payment_id, retry_strategy, channelmanager. get_cm ( ) )
@@ -51,9 +52,10 @@ pub fn pay_invoice<C: AChannelManager>(
5152/// [`PaymentHash`] has never been paid before.
5253///
5354/// See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
54- pub fn pay_invoice_with_id < C : AChannelManager > (
55- invoice : & Bolt11Invoice , payment_id : PaymentId , retry_strategy : Retry , channelmanager : & C
55+ pub fn pay_invoice_with_id < C : Deref > (
56+ invoice : & Bolt11Invoice , payment_id : PaymentId , retry_strategy : Retry , channelmanager : C
5657) -> Result < ( ) , PaymentError >
58+ where C :: Target : AChannelManager ,
5759{
5860 let amt_msat = invoice. amount_milli_satoshis ( ) . ok_or ( PaymentError :: Invoice ( "amount missing" ) ) ?;
5961 pay_invoice_using_amount ( invoice, amt_msat, payment_id, retry_strategy, channelmanager. get_cm ( ) )
@@ -68,9 +70,10 @@ pub fn pay_invoice_with_id<C: AChannelManager>(
6870///
6971/// If you wish to use a different payment idempotency token, see
7072/// [`pay_zero_value_invoice_with_id`].
71- pub fn pay_zero_value_invoice < C : AChannelManager > (
72- invoice : & Bolt11Invoice , amount_msats : u64 , retry_strategy : Retry , channelmanager : & C
73+ pub fn pay_zero_value_invoice < C : Deref > (
74+ invoice : & Bolt11Invoice , amount_msats : u64 , retry_strategy : Retry , channelmanager : C
7375) -> Result < PaymentId , PaymentError >
76+ where C :: Target : AChannelManager ,
7477{
7578 let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
7679 pay_zero_value_invoice_with_id ( invoice, amount_msats, payment_id, retry_strategy,
@@ -89,10 +92,11 @@ pub fn pay_zero_value_invoice<C: AChannelManager>(
8992///
9093/// See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
9194/// idempotency token.
92- pub fn pay_zero_value_invoice_with_id < C : AChannelManager > (
95+ pub fn pay_zero_value_invoice_with_id < C : Deref > (
9396 invoice : & Bolt11Invoice , amount_msats : u64 , payment_id : PaymentId , retry_strategy : Retry ,
94- channelmanager : & C
97+ channelmanager : C
9598) -> Result < ( ) , PaymentError >
99+ where C :: Target : AChannelManager ,
96100{
97101 if invoice. amount_milli_satoshis ( ) . is_some ( ) {
98102 Err ( PaymentError :: Invoice ( "amount unexpected" ) )
@@ -124,9 +128,10 @@ fn pay_invoice_using_amount<P: Deref>(
124128/// Sends payment probes over all paths of a route that would be used to pay the given invoice.
125129///
126130/// See [`ChannelManager::send_preflight_probes`] for more information.
127- pub fn preflight_probe_invoice < C : AChannelManager > (
128- invoice : & Bolt11Invoice , channelmanager : & C , liquidity_limit_multiplier : Option < u64 > ,
131+ pub fn preflight_probe_invoice < C : Deref > (
132+ invoice : & Bolt11Invoice , channelmanager : C , liquidity_limit_multiplier : Option < u64 > ,
129133) -> Result < Vec < ( PaymentHash , PaymentId ) > , ProbingError >
134+ where C :: Target : AChannelManager ,
130135{
131136 let amount_msat = if let Some ( invoice_amount_msat) = invoice. amount_milli_satoshis ( ) {
132137 invoice_amount_msat
@@ -155,10 +160,11 @@ pub fn preflight_probe_invoice<C: AChannelManager>(
155160/// invoice using the given amount.
156161///
157162/// See [`ChannelManager::send_preflight_probes`] for more information.
158- pub fn preflight_probe_zero_value_invoice < C : AChannelManager > (
159- invoice : & Bolt11Invoice , amount_msat : u64 , channelmanager : & C ,
163+ pub fn preflight_probe_zero_value_invoice < C : Deref > (
164+ invoice : & Bolt11Invoice , amount_msat : u64 , channelmanager : C ,
160165 liquidity_limit_multiplier : Option < u64 > ,
161166) -> Result < Vec < ( PaymentHash , PaymentId ) > , ProbingError >
167+ where C :: Target : AChannelManager ,
162168{
163169 if invoice. amount_milli_satoshis ( ) . is_some ( ) {
164170 return Err ( ProbingError :: Invoice ( "amount unexpected" ) ) ;
0 commit comments