Skip to content

Commit c9d3bb3

Browse files
committed
Rename NonUniquePaymentHash error to DuplicatePayment
1 parent 02a4b08 commit c9d3bb3

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

bindings/ldk_node.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ enum NodeError {
8686
"InvalidInvoice",
8787
"InvalidChannelId",
8888
"InvalidNetwork",
89-
"NonUniquePaymentHash",
89+
"DuplicatePayment",
9090
"InsufficientFunds",
9191
};
9292

src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ pub enum Error {
4747
InvalidChannelId,
4848
/// The given network is invalid.
4949
InvalidNetwork,
50-
/// Payment of the given invoice has already been intiated.
51-
NonUniquePaymentHash,
50+
/// A payment with the given hash has already been intiated.
51+
DuplicatePayment,
5252
/// There are insufficient funds to complete the given operation.
5353
InsufficientFunds,
5454
}
@@ -80,7 +80,7 @@ impl fmt::Display for Error {
8080
Self::InvalidInvoice => write!(f, "The given invoice is invalid."),
8181
Self::InvalidChannelId => write!(f, "The given channel ID is invalid."),
8282
Self::InvalidNetwork => write!(f, "The given network is invalid."),
83-
Self::NonUniquePaymentHash => write!(f, "An invoice must not get payed twice."),
83+
Self::DuplicatePayment => write!(f, "A payment with the given hash has already been initiated."),
8484
Self::InsufficientFunds => {
8585
write!(f, "There are insufficient funds to complete the given operation.")
8686
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ impl Node {
11451145

11461146
if self.payment_store.contains(&payment_hash) {
11471147
log_error!(self.logger, "Payment error: an invoice must not get paid twice.");
1148-
return Err(Error::NonUniquePaymentHash);
1148+
return Err(Error::DuplicatePayment);
11491149
}
11501150

11511151
let payment_secret = Some(*invoice.payment_secret());
@@ -1220,7 +1220,7 @@ impl Node {
12201220
let payment_hash = PaymentHash((*invoice.payment_hash()).into_inner());
12211221
if self.payment_store.contains(&payment_hash) {
12221222
log_error!(self.logger, "Payment error: an invoice must not get paid twice.");
1223-
return Err(Error::NonUniquePaymentHash);
1223+
return Err(Error::DuplicatePayment);
12241224
}
12251225

12261226
let payment_id = PaymentId(invoice.payment_hash().into_inner());

src/test/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn channel_full_cycle() {
122122
assert_eq!(node_b.payment(&payment_hash).unwrap().amount_msat, Some(invoice_amount_1_msat));
123123

124124
// Assert we fail duplicate outbound payments.
125-
assert_eq!(Err(Error::NonUniquePaymentHash), node_a.send_payment(&invoice));
125+
assert_eq!(Err(Error::DuplicatePayment), node_a.send_payment(&invoice));
126126

127127
// Test under-/overpayment
128128
let invoice_amount_2_msat = 1000_000;

0 commit comments

Comments
 (0)