Skip to content

Commit 28bf6a3

Browse files
f: don't make the funding_tx an Arc
1 parent ecf1df3 commit 28bf6a3

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lightning-liquidity/src/lsps2/service.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ enum TrustModel {
114114
ClientTrustsLsp {
115115
funding_tx_broadcast_safe: bool,
116116
payment_claimed: bool,
117-
funding_tx: Option<Arc<Transaction>>,
117+
funding_tx: Option<Transaction>,
118118
},
119119
LspTrustsClient,
120120
}
@@ -144,7 +144,7 @@ impl TrustModel {
144144
}
145145
}
146146

147-
fn set_funding_tx(&mut self, funding_tx: Arc<Transaction>) {
147+
fn set_funding_tx(&mut self, funding_tx: Transaction) {
148148
match self {
149149
TrustModel::ClientTrustsLsp { funding_tx: tx, .. } => {
150150
*tx = Some(funding_tx);
@@ -177,9 +177,9 @@ impl TrustModel {
177177
}
178178
}
179179

180-
fn get_funding_tx(&self) -> Option<Arc<Transaction>> {
180+
fn get_funding_tx(&self) -> Option<Transaction> {
181181
match self {
182-
TrustModel::ClientTrustsLsp { funding_tx: Some(tx), .. } => Some(Arc::clone(&tx)),
182+
TrustModel::ClientTrustsLsp { funding_tx, .. } => funding_tx.clone(),
183183
_ => None,
184184
}
185185
}
@@ -518,7 +518,7 @@ impl OutboundJITChannel {
518518
self.is_pending_initial_payment() && is_expired
519519
}
520520

521-
fn set_funding_tx(&mut self, funding_tx: Arc<Transaction>) {
521+
fn set_funding_tx(&mut self, funding_tx: Transaction) {
522522
self.trust_model.set_funding_tx(funding_tx);
523523
}
524524

@@ -530,7 +530,7 @@ impl OutboundJITChannel {
530530
self.trust_model.should_manually_broadcast()
531531
}
532532

533-
fn get_funding_tx(&self) -> Option<Arc<Transaction>> {
533+
fn get_funding_tx(&self) -> Option<Transaction> {
534534
self.trust_model.get_funding_tx()
535535
}
536536

@@ -1575,8 +1575,7 @@ where
15751575
/// Called to store the funding transaction for a JIT channel.
15761576
/// This should be called when the funding transaction is created but before it's broadcast.
15771577
pub fn store_funding_transaction(
1578-
&self, user_channel_id: u128, counterparty_node_id: &PublicKey,
1579-
funding_tx: Arc<Transaction>,
1578+
&self, user_channel_id: u128, counterparty_node_id: &PublicKey, funding_tx: Transaction,
15801579
) -> Result<(), APIError> {
15811580
let outer_state_lock = self.per_peer_state.read().unwrap();
15821581
let inner_state_lock =
@@ -1656,7 +1655,7 @@ where
16561655
let event = LSPS2ServiceEvent::BroadcastFundingTransaction {
16571656
counterparty_node_id: *counterparty_node_id,
16581657
user_channel_id: jit_channel.user_channel_id,
1659-
funding_tx: funding_tx.as_ref().clone(),
1658+
funding_tx,
16601659
};
16611660
event_queue_notifier.enqueue(event);
16621661
}

lightning-liquidity/tests/lsps2_integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ fn create_channel_with_manual_broadcast(
12831283
);
12841284
let service_handler = service_node.liquidity_manager.lsps2_service_handler().unwrap();
12851285
service_handler
1286-
.store_funding_transaction(user_channel_id, &client_node_id, Arc::new(tx.clone()))
1286+
.store_funding_transaction(user_channel_id, &client_node_id, tx.clone())
12871287
.unwrap();
12881288
service_node
12891289
.node

0 commit comments

Comments
 (0)