Skip to content

Commit 4d565a9

Browse files
author
Antoine Riard
committed
-f Drop default()
1 parent 1f016b3 commit 4d565a9

File tree

2 files changed

+7
-26
lines changed

2 files changed

+7
-26
lines changed

lightning/src/chain/onchain_utils.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -609,15 +609,6 @@ impl PackageTemplate {
609609
}
610610
}
611611

612-
impl Default for PackageTemplate {
613-
fn default() -> Self {
614-
PackageTemplate {
615-
inputs: Vec::new(),
616-
malleability: PackageMalleability::Malleable,
617-
}
618-
}
619-
}
620-
621612
impl Writeable for PackageTemplate {
622613
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
623614
writer.write_all(&byte_utils::be64_to_array(self.inputs.len() as u64))?;
@@ -746,20 +737,6 @@ impl OnchainRequest {
746737
}
747738
}
748739

749-
impl Default for OnchainRequest {
750-
fn default() -> Self {
751-
OnchainRequest {
752-
aggregation: true,
753-
bump_strategy: BumpStrategy::RBF,
754-
feerate_previous: 0,
755-
height_timer: None,
756-
absolute_timelock: ::std::u32::MAX,
757-
height_original: 0,
758-
content: PackageTemplate::default()
759-
}
760-
}
761-
}
762-
763740
impl Writeable for OnchainRequest {
764741
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ::std::io::Error> {
765742
self.aggregation.write(writer)?;

lightning/src/chain/onchaintx.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
367367
};
368368
log_trace!(logger, "Updating claims view at height {} with {} matched transactions and {} claim requests", height, txn_matched.len(), requests.len());
369369
let mut preprocessed_requests = Vec::with_capacity(requests.len());
370-
let mut aggregated_request = OnchainRequest::default();
370+
let mut aggregated_request = None;
371371

372372
// Try to aggregate outputs if their timelock expiration isn't imminent (absolute_timelock
373373
// <= CLTV_SHARED_CLAIM_BUFFER) and they don't require an immediate nLockTime (aggregable).
@@ -378,12 +378,16 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
378378
if req.absolute_timelock <= height + CLTV_SHARED_CLAIM_BUFFER || !req.aggregation {
379379
// Don't aggregate if outpoint absolute timelock is soon or marked as non-aggregable
380380
preprocessed_requests.push(req);
381+
} else if aggregated_request.is_none() {
382+
aggregated_request = Some(req);
381383
} else {
382-
aggregated_request.request_merge(req);
384+
aggregated_request.as_mut().unwrap().request_merge(req);
383385
}
384386
}
385387
}
386-
preprocessed_requests.push(aggregated_request);
388+
if let Some(req) = aggregated_request {
389+
preprocessed_requests.push(req);
390+
}
387391

388392
// Generate claim transactions and track them to bump if necessary at
389393
// height timer expiration (i.e in how many blocks we're going to take action).

0 commit comments

Comments
 (0)