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