Skip to content

Commit 4304326

Browse files
committed
Remove single transaction vecs in wallet broadcast path
1 parent 8963226 commit 4304326

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/tx_broadcaster.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ impl BroadcastPackage {
3333
}
3434

3535
/// Builds a package for wallet-originated broadcasts that have no LDK classification.
36-
fn unclassified(txs: Vec<Transaction>) -> Self {
37-
Self(txs.into_iter().map(|tx| (tx, None)).collect())
36+
fn unclassified(tx: Transaction) -> Self {
37+
Self(vec![(tx, None)])
3838
}
3939

4040
/// The packaged transactions and their types, for classification.
@@ -106,8 +106,8 @@ where
106106
Ok(package)
107107
}
108108

109-
pub(crate) fn broadcast_unclassified_transactions(&self, txs: Vec<Transaction>) {
110-
self.queue_sender.try_send(BroadcastPackage::unclassified(txs)).unwrap_or_else(|e| {
109+
pub(crate) fn broadcast_unclassified_transaction(&self, tx: Transaction) {
110+
self.queue_sender.try_send(BroadcastPackage::unclassified(tx)).unwrap_or_else(|e| {
111111
log_error!(self.logger, "Failed to broadcast transactions: {}", e);
112112
});
113113
}

src/wallet/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl Wallet {
330330
.into_iter()
331331
.filter_map(|txid| {
332332
let tx = locked_wallet.tx_details(txid).map(|d| (*d.tx).clone())?;
333-
self.broadcaster.broadcast_unclassified_transactions(vec![tx]);
333+
self.broadcaster.broadcast_unclassified_transaction(tx);
334334
Some(())
335335
})
336336
.count();
@@ -878,7 +878,7 @@ impl Wallet {
878878
};
879879

880880
let txid = tx.compute_txid();
881-
self.broadcaster.broadcast_unclassified_transactions(vec![tx]);
881+
self.broadcaster.broadcast_unclassified_transaction(tx);
882882

883883
match send_amount {
884884
OnchainSendAmount::ExactRetainingReserve { amount_sats, .. } => {
@@ -1758,7 +1758,7 @@ impl Wallet {
17581758
self.runtime
17591759
.block_on(self.pending_payment_store.insert_or_update(pending_payment_store))?;
17601760

1761-
self.broadcaster.broadcast_unclassified_transactions(vec![fee_bumped_tx]);
1761+
self.broadcaster.broadcast_unclassified_transaction(fee_bumped_tx);
17621762

17631763
log_info!(self.logger, "RBF successful: replaced {} with {}", txid, new_txid);
17641764

0 commit comments

Comments
 (0)