Skip to content

Commit a19edbc

Browse files
committed
Rename PackageTemplate::timelock counteraprty_spendable_height
This function was very confusing - its used to determine by when we have to stop aggregating this claim with others as it starts to be at risk of pinning due to the counterparty's ability to spend the output. It is not ever used as a timelock for a transaction, and thus its name is very confusing. Instead we rename it `counterparty_spendable_height`.
1 parent 2f549ee commit a19edbc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lightning/src/chain/onchaintx.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,8 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
765765
continue;
766766
}
767767

768-
log_trace!(logger, "Test if outpoint can be aggregated with expiration {} against {}", req.timelock(), cur_height + CLTV_SHARED_CLAIM_BUFFER);
769-
if req.timelock() <= cur_height + CLTV_SHARED_CLAIM_BUFFER || !req.aggregable() {
770-
// Don't aggregate if outpoint package timelock is soon or marked as non-aggregable
768+
log_trace!(logger, "Test if outpoint which our counterparty can spend at {} can be aggregated based on aggregation limit {}", req.counterparty_spendable_height(), cur_height + CLTV_SHARED_CLAIM_BUFFER);
769+
if req.counterparty_spendable_height() <= cur_height + CLTV_SHARED_CLAIM_BUFFER || !req.aggregable() {
771770
preprocessed_requests.push(req);
772771
} else if aggregated_request.is_none() {
773772
aggregated_request = Some(req);

lightning/src/chain/package.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,11 @@ impl PackageTemplate {
755755
pub(crate) fn is_malleable(&self) -> bool {
756756
self.malleability == PackageMalleability::Malleable
757757
}
758-
pub(crate) fn timelock(&self) -> u32 {
758+
/// The height at which our counterparty may be able to spend this output.
759+
///
760+
/// This is an important limit for aggregation as after this height our counterparty may be
761+
/// able to pin transactions spending this output in the mempool.
762+
pub(crate) fn counterparty_spendable_height(&self) -> u32 {
759763
self.soonest_conf_deadline
760764
}
761765
pub(crate) fn aggregable(&self) -> bool {

0 commit comments

Comments
 (0)