File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ enum NodeError {
92
92
"InvalidInvoice",
93
93
"InvalidChannelId",
94
94
"InvalidNetwork",
95
- "NonUniquePaymentHash ",
95
+ "DuplicatePayment ",
96
96
"InsufficientFunds",
97
97
};
98
98
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ pub enum Error {
51
51
InvalidChannelId ,
52
52
/// The given network is invalid.
53
53
InvalidNetwork ,
54
- /// Payment of the given invoice has already been intiated.
55
- NonUniquePaymentHash ,
54
+ /// A payment with the given hash has already been intiated.
55
+ DuplicatePayment ,
56
56
/// There are insufficient funds to complete the given operation.
57
57
InsufficientFunds ,
58
58
}
@@ -86,7 +86,9 @@ impl fmt::Display for Error {
86
86
Self :: InvalidInvoice => write ! ( f, "The given invoice is invalid." ) ,
87
87
Self :: InvalidChannelId => write ! ( f, "The given channel ID is invalid." ) ,
88
88
Self :: InvalidNetwork => write ! ( f, "The given network is invalid." ) ,
89
- Self :: NonUniquePaymentHash => write ! ( f, "An invoice must not get payed twice." ) ,
89
+ Self :: DuplicatePayment => {
90
+ write ! ( f, "A payment with the given hash has already been initiated." )
91
+ }
90
92
Self :: InsufficientFunds => {
91
93
write ! ( f, "There are insufficient funds to complete the given operation." )
92
94
}
Original file line number Diff line number Diff line change @@ -1299,7 +1299,7 @@ impl Node {
1299
1299
1300
1300
if self . payment_store . contains ( & payment_hash) {
1301
1301
log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1302
- return Err ( Error :: NonUniquePaymentHash ) ;
1302
+ return Err ( Error :: DuplicatePayment ) ;
1303
1303
}
1304
1304
1305
1305
let payment_secret = Some ( * invoice. payment_secret ( ) ) ;
@@ -1374,7 +1374,7 @@ impl Node {
1374
1374
let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
1375
1375
if self . payment_store . contains ( & payment_hash) {
1376
1376
log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1377
- return Err ( Error :: NonUniquePaymentHash ) ;
1377
+ return Err ( Error :: DuplicatePayment ) ;
1378
1378
}
1379
1379
1380
1380
let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ fn channel_full_cycle() {
127
127
assert_eq ! ( node_b. payment( & payment_hash) . unwrap( ) . amount_msat, Some ( invoice_amount_1_msat) ) ;
128
128
129
129
// Assert we fail duplicate outbound payments.
130
- assert_eq ! ( Err ( Error :: NonUniquePaymentHash ) , node_a. send_payment( & invoice) ) ;
130
+ assert_eq ! ( Err ( Error :: DuplicatePayment ) , node_a. send_payment( & invoice) ) ;
131
131
132
132
// Test under-/overpayment
133
133
let invoice_amount_2_msat = 1000_000 ;
You can’t perform that action at this time.
0 commit comments