From 0380c65afc2caf3346498fae67e5f302ad2159eb Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 13 May 2024 14:36:01 +0000 Subject: [PATCH] [UPSTREAM] impl `Clone` on unsigned BOLT12 types This is required for bindings as passing types from Rust to GC'd languages can't map the concept of a type that has a lifetime of the called function but instead needs to clone for safety. --- lightning/src/ln/onion_payment.rs | 2 +- lightning/src/offers/invoice.rs | 1 + lightning/src/offers/invoice_request.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index 8293a3202..20a1e1dbb 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -26,7 +26,7 @@ use crate::prelude::*; use core::ops::Deref; /// Invalid inbound onion payment. -#[derive(Debug)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct InboundHTLCErr { /// BOLT 4 error code. pub err_code: u16, diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 1f19c5971..c1ad5b320 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -503,6 +503,7 @@ for InvoiceBuilder<'a, DerivedSigningPubkey> { /// /// This is serialized as a TLV stream, which includes TLV records from the originating message. As /// such, it may include unknown, odd TLV records. +#[derive(Clone)] pub struct UnsignedBolt12Invoice { bytes: Vec, contents: InvoiceContents, diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index faeef26c8..9041fa8a9 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -487,6 +487,7 @@ for InvoiceRequestBuilder<'a, 'b, DerivedPayerId, secp256k1::All> { /// /// This is serialized as a TLV stream, which includes TLV records from the originating message. As /// such, it may include unknown, odd TLV records. +#[derive(Clone)] pub struct UnsignedInvoiceRequest { bytes: Vec, contents: InvoiceRequestContents, -- 2.39.5