File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ enum NodeError {
101101 "InvalidInvoice",
102102 "InvalidChannelId",
103103 "InvalidNetwork",
104- "NonUniquePaymentHash ",
104+ "DuplicatePayment ",
105105 "InsufficientFunds",
106106};
107107
Original file line number Diff line number Diff line change @@ -53,8 +53,8 @@ pub enum Error {
5353 InvalidChannelId ,
5454 /// The given network is invalid.
5555 InvalidNetwork ,
56- /// Payment of the given invoice has already been intiated.
57- NonUniquePaymentHash ,
56+ /// A payment with the given hash has already been intiated.
57+ DuplicatePayment ,
5858 /// There are insufficient funds to complete the given operation.
5959 InsufficientFunds ,
6060}
@@ -89,7 +89,9 @@ impl fmt::Display for Error {
8989 Self :: InvalidInvoice => write ! ( f, "The given invoice is invalid." ) ,
9090 Self :: InvalidChannelId => write ! ( f, "The given channel ID is invalid." ) ,
9191 Self :: InvalidNetwork => write ! ( f, "The given network is invalid." ) ,
92- Self :: NonUniquePaymentHash => write ! ( f, "An invoice must not get payed twice." ) ,
92+ Self :: DuplicatePayment => {
93+ write ! ( f, "A payment with the given hash has already been initiated." )
94+ }
9395 Self :: InsufficientFunds => {
9496 write ! ( f, "There are insufficient funds to complete the given operation." )
9597 }
Original file line number Diff line number Diff line change @@ -1404,7 +1404,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
14041404
14051405 if self . payment_store . contains ( & payment_hash) {
14061406 log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1407- return Err ( Error :: NonUniquePaymentHash ) ;
1407+ return Err ( Error :: DuplicatePayment ) ;
14081408 }
14091409
14101410 let payment_secret = Some ( * invoice. payment_secret ( ) ) ;
@@ -1479,7 +1479,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
14791479 let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
14801480 if self . payment_store . contains ( & payment_hash) {
14811481 log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1482- return Err ( Error :: NonUniquePaymentHash ) ;
1482+ return Err ( Error :: DuplicatePayment ) ;
14831483 }
14841484
14851485 let payment_id = PaymentId ( invoice. payment_hash ( ) . into_inner ( ) ) ;
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ fn channel_full_cycle() {
131131 assert_eq ! ( node_b. payment( & payment_hash) . unwrap( ) . amount_msat, Some ( invoice_amount_1_msat) ) ;
132132
133133 // Assert we fail duplicate outbound payments.
134- assert_eq ! ( Err ( Error :: NonUniquePaymentHash ) , node_a. send_payment( & invoice) ) ;
134+ assert_eq ! ( Err ( Error :: DuplicatePayment ) , node_a. send_payment( & invoice) ) ;
135135
136136 // Test under-/overpayment
137137 let invoice_amount_2_msat = 1000_000 ;
You can’t perform that action at this time.
0 commit comments