Skip to content

Commit d2848f3

Browse files
committed
f - use absolute expiry in add_new_awaiting_invoice
1 parent 2ea457e commit d2848f3

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7118,7 +7118,7 @@ where
71187118
/// [`Refund`]: crate::offers::refund::Refund
71197119
/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
71207120
pub fn create_refund_builder(
7121-
&self, description: String, amount_msats: u64, absolute_expiry: Option<Duration>,
7121+
&self, description: String, amount_msats: u64, absolute_expiry: Duration,
71227122
payment_id: PaymentId, retry_strategy: Retry, max_total_routing_fee_msat: Option<u64>
71237123
) -> Result<RefundBuilder<secp256k1::All>, Bolt12SemanticError> {
71247124
let node_id = self.get_our_node_id();
@@ -7129,21 +7129,13 @@ where
71297129
// TODO: Set blinded paths
71307130
let builder = RefundBuilder::deriving_payer_id(
71317131
description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id
7132-
)?.chain_hash(self.chain_hash);
7133-
7134-
let builder = match absolute_expiry {
7135-
Some(absolute_expiry) => builder.absolute_expiry(absolute_expiry),
7136-
None => builder,
7137-
};
7138-
7139-
const SECONDS_PER_TIMER_TICK: u64 = 60;
7140-
let timer_ticks_before_expiration =
7141-
absolute_expiry.map(|expiry| expiry.as_secs() / SECONDS_PER_TIMER_TICK);
7132+
)?
7133+
.chain_hash(self.chain_hash)
7134+
.absolute_expiry(absolute_expiry);
71427135

71437136
self.pending_outbound_payments
7144-
.add_new_awaiting_invoice_for_refund(
7145-
payment_id, retry_strategy, max_total_routing_fee_msat,
7146-
timer_ticks_before_expiration
7137+
.add_new_awaiting_invoice(
7138+
payment_id, absolute_expiry, retry_strategy, max_total_routing_fee_msat,
71477139
)
71487140
.map_err(|_| Bolt12SemanticError::DuplicatePaymentId)?;
71497141

lightning/src/ln/outbound_payment.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,7 @@ impl OutboundPayments {
12681268
(payment, onion_session_privs)
12691269
}
12701270

1271-
#[allow(unused)]
1272-
fn add_new_awaiting_invoice(
1271+
pub(super) fn add_new_awaiting_invoice(
12731272
&self, payment_id: PaymentId, absolute_expiry: Duration, retry_strategy: Retry,
12741273
max_total_routing_fee_msat: Option<u64>
12751274
) -> Result<(), ()> {

0 commit comments

Comments
 (0)