Skip to content

Commit bccddca

Browse files
committed
impl Clone on various public (mostly 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.
1 parent 7e69d83 commit bccddca

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

lightning/src/ln/onion_payment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::prelude::*;
2626
use core::ops::Deref;
2727

2828
/// Invalid inbound onion payment.
29-
#[derive(Debug)]
29+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
3030
pub struct InboundHTLCErr {
3131
/// BOLT 4 error code.
3232
pub err_code: u16,

lightning/src/offers/invoice.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ for InvoiceBuilder<'a, DerivedSigningPubkey> {
503503
///
504504
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
505505
/// such, it may include unknown, odd TLV records.
506+
#[derive(Clone)]
506507
pub struct UnsignedBolt12Invoice {
507508
bytes: Vec<u8>,
508509
contents: InvoiceContents,

lightning/src/offers/invoice_request.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ for InvoiceRequestBuilder<'a, 'b, DerivedPayerId, secp256k1::All> {
487487
///
488488
/// This is serialized as a TLV stream, which includes TLV records from the originating message. As
489489
/// such, it may include unknown, odd TLV records.
490+
#[derive(Clone)]
490491
pub struct UnsignedInvoiceRequest {
491492
bytes: Vec<u8>,
492493
contents: InvoiceRequestContents,

lightning/src/offers/offer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ pub struct OfferBuilder<'a, M: MetadataStrategy, T: secp256k1::Signing> {
165165
///
166166
/// [module-level documentation]: self
167167
#[cfg(c_bindings)]
168+
#[derive(Clone)]
168169
pub struct OfferWithExplicitMetadataBuilder<'a> {
169170
offer: OfferContents,
170171
metadata_strategy: core::marker::PhantomData<ExplicitMetadata>,
@@ -177,6 +178,7 @@ pub struct OfferWithExplicitMetadataBuilder<'a> {
177178
///
178179
/// [module-level documentation]: self
179180
#[cfg(c_bindings)]
181+
#[derive(Clone)]
180182
pub struct OfferWithDerivedMetadataBuilder<'a> {
181183
offer: OfferContents,
182184
metadata_strategy: core::marker::PhantomData<DerivedMetadata>,

lightning/src/offers/refund.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ pub struct RefundBuilder<'a, T: secp256k1::Signing> {
141141
///
142142
/// [module-level documentation]: self
143143
#[cfg(c_bindings)]
144+
#[derive(Clone)]
144145
pub struct RefundMaybeWithDerivedMetadataBuilder<'a> {
145146
refund: RefundContents,
146147
secp_ctx: Option<&'a Secp256k1<secp256k1::All>>,

0 commit comments

Comments
 (0)