@@ -32,9 +32,10 @@ use core::time::Duration;
32
32
/// with the same [`PaymentHash`] is never sent.
33
33
///
34
34
/// 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
37
37
) -> Result < PaymentId , PaymentError >
38
+ where C :: Target : AChannelManager ,
38
39
{
39
40
let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
40
41
pay_invoice_with_id ( invoice, payment_id, retry_strategy, channelmanager. get_cm ( ) )
@@ -51,9 +52,10 @@ pub fn pay_invoice<C: AChannelManager>(
51
52
/// [`PaymentHash`] has never been paid before.
52
53
///
53
54
/// 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
56
57
) -> Result < ( ) , PaymentError >
58
+ where C :: Target : AChannelManager ,
57
59
{
58
60
let amt_msat = invoice. amount_milli_satoshis ( ) . ok_or ( PaymentError :: Invoice ( "amount missing" ) ) ?;
59
61
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>(
68
70
///
69
71
/// If you wish to use a different payment idempotency token, see
70
72
/// [`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
73
75
) -> Result < PaymentId , PaymentError >
76
+ where C :: Target : AChannelManager ,
74
77
{
75
78
let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
76
79
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>(
89
92
///
90
93
/// See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
91
94
/// idempotency token.
92
- pub fn pay_zero_value_invoice_with_id < C : AChannelManager > (
95
+ pub fn pay_zero_value_invoice_with_id < C : Deref > (
93
96
invoice : & Bolt11Invoice , amount_msats : u64 , payment_id : PaymentId , retry_strategy : Retry ,
94
- channelmanager : & C
97
+ channelmanager : C
95
98
) -> Result < ( ) , PaymentError >
99
+ where C :: Target : AChannelManager ,
96
100
{
97
101
if invoice. amount_milli_satoshis ( ) . is_some ( ) {
98
102
Err ( PaymentError :: Invoice ( "amount unexpected" ) )
@@ -124,9 +128,10 @@ fn pay_invoice_using_amount<P: Deref>(
124
128
/// Sends payment probes over all paths of a route that would be used to pay the given invoice.
125
129
///
126
130
/// 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 > ,
129
133
) -> Result < Vec < ( PaymentHash , PaymentId ) > , ProbingError >
134
+ where C :: Target : AChannelManager ,
130
135
{
131
136
let amount_msat = if let Some ( invoice_amount_msat) = invoice. amount_milli_satoshis ( ) {
132
137
invoice_amount_msat
@@ -155,10 +160,11 @@ pub fn preflight_probe_invoice<C: AChannelManager>(
155
160
/// invoice using the given amount.
156
161
///
157
162
/// 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 ,
160
165
liquidity_limit_multiplier : Option < u64 > ,
161
166
) -> Result < Vec < ( PaymentHash , PaymentId ) > , ProbingError >
167
+ where C :: Target : AChannelManager ,
162
168
{
163
169
if invoice. amount_milli_satoshis ( ) . is_some ( ) {
164
170
return Err ( ProbingError :: Invoice ( "amount unexpected" ) ) ;
0 commit comments