]> git.bitcoin.ninja Git - rust-lightning/commitdiff
[UPSTREAM] impl `Clone` on unsigned BOLT12 types
authorMatt Corallo <git@bluematt.me>
Mon, 13 May 2024 14:36:01 +0000 (14:36 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 13 May 2024 14:42:59 +0000 (14:42 +0000)
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
lightning/src/offers/invoice.rs
lightning/src/offers/invoice_request.rs

index 8293a32021e3285dd91a651274c2ca11b902552c..20a1e1dbb621f4a0c4ce68ed9f5a5e0df6aad278 100644 (file)
@@ -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,
index 1f19c5971b3cc02cdbd4547e2fb70ec7e5f5830d..c1ad5b3201a6d3f20f02b0ee6782557bb8d86b9b 100644 (file)
@@ -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<u8>,
        contents: InvoiceContents,
index faeef26c82f2332b31f6c689e18cd49889cae2af..9041fa8a9bf422ec75f4ba273be80a7bc815c1e6 100644 (file)
@@ -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<u8>,
        contents: InvoiceRequestContents,