onchain_events_awaiting_threshold_conf: Vec<OnchainEventEntry>,
- latest_height: u32,
pub(super) secp_ctx: Secp256k1<secp256k1::All>,
}
}
}
}
- self.latest_height.write(writer)?;
write_tlv_fields!(writer, {}, {});
Ok(())
};
onchain_events_awaiting_threshold_conf.push(OnchainEventEntry { txid, height, event });
}
- let latest_height = Readable::read(reader)?;
read_tlv_fields!(reader, {}, {});
claimable_outpoints,
pending_claim_requests,
onchain_events_awaiting_threshold_conf,
- latest_height,
secp_ctx,
})
}
pending_claim_requests: HashMap::new(),
claimable_outpoints: HashMap::new(),
onchain_events_awaiting_threshold_conf: Vec::new(),
- latest_height: 0,
secp_ctx,
}
// Compute new height timer to decide when we need to regenerate a new bumped version of the claim tx (if we
// didn't receive confirmation of it before, or not enough reorg-safe depth on top of it).
let new_timer = Some(cached_request.get_height_timer(height));
- let amt = cached_request.package_amount();
if cached_request.is_malleable() {
let predicted_weight = cached_request.package_weight(&self.destination_script);
- if let Some((output_value, new_feerate)) = cached_request.compute_package_output(predicted_weight, amt, fee_estimator, logger) {
+ if let Some((output_value, new_feerate)) = cached_request.compute_package_output(predicted_weight, fee_estimator, logger) {
assert!(new_feerate != 0);
let transaction = cached_request.finalize_package(self, output_value, self.destination_script.clone(), logger).unwrap();
// Note: Currently, amounts of holder outputs spending witnesses aren't used
// as we can't malleate spending package to increase their feerate. This
// should change with the remaining anchor output patchset.
- debug_assert!(amt == 0);
- if let Some(transaction) = cached_request.finalize_package(self, amt, self.destination_script.clone(), logger) {
+ if let Some(transaction) = cached_request.finalize_package(self, 0, self.destination_script.clone(), logger) {
return Some((None, 0, transaction));
}
}
/// for this channel, provide new relevant on-chain transactions and/or new claim requests.
/// Formerly this was named `block_connected`, but it is now also used for claiming an HTLC output
/// if we receive a preimage after force-close.
- pub(crate) fn update_claims_view<B: Deref, F: Deref, L: Deref>(&mut self, txn_matched: &[&Transaction], requests: Vec<PackageTemplate>, latest_height: Option<u32>, broadcaster: &B, fee_estimator: &F, logger: &L)
+ pub(crate) fn update_claims_view<B: Deref, F: Deref, L: Deref>(&mut self, txn_matched: &[&Transaction], requests: Vec<PackageTemplate>, height: u32, broadcaster: &B, fee_estimator: &F, logger: &L)
where B::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
{
- let height = match latest_height {
- Some(h) => h,
- None => self.latest_height,
- };
log_trace!(logger, "Updating claims view at height {} with {} matched transactions and {} claim requests", height, txn_matched.len(), requests.len());
let mut preprocessed_requests = Vec::with_capacity(requests.len());
let mut aggregated_request = None;