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 {
9292 "InvalidInvoice",
9393 "InvalidChannelId",
9494 "InvalidNetwork",
95- "NonUniquePaymentHash ",
95+ "DuplicatePayment ",
9696 "InsufficientFunds",
9797};
9898
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ pub enum Error {
5151 InvalidChannelId ,
5252 /// The given network is invalid.
5353 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 ,
5656 /// There are insufficient funds to complete the given operation.
5757 InsufficientFunds ,
5858}
@@ -86,7 +86,9 @@ impl fmt::Display for Error {
8686 Self :: InvalidInvoice => write ! ( f, "The given invoice is invalid." ) ,
8787 Self :: InvalidChannelId => write ! ( f, "The given channel ID is invalid." ) ,
8888 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+ }
9092 Self :: InsufficientFunds => {
9193 write ! ( f, "There are insufficient funds to complete the given operation." )
9294 }
Original file line number Diff line number Diff line change @@ -1299,7 +1299,7 @@ impl Node {
12991299
13001300 if self . payment_store . contains ( & payment_hash) {
13011301 log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1302- return Err ( Error :: NonUniquePaymentHash ) ;
1302+ return Err ( Error :: DuplicatePayment ) ;
13031303 }
13041304
13051305 let payment_secret = Some ( * invoice. payment_secret ( ) ) ;
@@ -1374,7 +1374,7 @@ impl Node {
13741374 let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
13751375 if self . payment_store . contains ( & payment_hash) {
13761376 log_error ! ( self . logger, "Payment error: an invoice must not get paid twice." ) ;
1377- return Err ( Error :: NonUniquePaymentHash ) ;
1377+ return Err ( Error :: DuplicatePayment ) ;
13781378 }
13791379
13801380 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() {
127127 assert_eq ! ( node_b. payment( & payment_hash) . unwrap( ) . amount_msat, Some ( invoice_amount_1_msat) ) ;
128128
129129 // 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) ) ;
131131
132132 // Test under-/overpayment
133133 let invoice_amount_2_msat = 1000_000 ;
You can’t perform that action at this time.
0 commit comments