From 4ca0953c8775c61740a0bd038eede1e8cbeaff37 Mon Sep 17 00:00:00 2001 From: Roman Dmitrienko Date: Fri, 1 Mar 2024 21:11:20 +0100 Subject: [PATCH] Add specific error code for invalid custom TLVs. --- src/error.rs | 2 ++ src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/error.rs b/src/error.rs index 0182b3092..7762426c3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -61,6 +61,8 @@ pub enum Error { InvalidChannelId, /// The given network is invalid. InvalidNetwork, + /// The custom TLVs are invalid. + InvalidCustomTlv, /// A payment with the given hash has already been initiated. DuplicatePayment, /// The available funds are insufficient to complete the given operation. diff --git a/src/lib.rs b/src/lib.rs index f580246e2..4741883c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1257,7 +1257,7 @@ impl Node { .with_custom_tlvs(custom_tlvs.into_iter().map(|tlv| (tlv.r#type, tlv.value)).collect()) .map_err(|_| { log_error!(self.logger, "Payment error: invalid custom TLVs."); - Error::PaymentSendingFailed + Error::InvalidCustomTlv })?; match self.channel_manager.send_spontaneous_payment_with_retry(