Skip to content

Commit 78fa3d4

Browse files
committed
f add missing CLTV_EXPIRY_DELTA offset
1 parent 4365981 commit 78fa3d4

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

lightning/src/chain/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ impl PackageTemplate {
10151015
// `CounterpartyReceivedHTLCOutput`
10161016
height_timer = cmp::min(
10171017
height_timer,
1018-
timer_for_target_conf(outp.cltv_expiry),
1018+
timer_for_target_conf(outp.cltv_expiry + MIN_CLTV_EXPIRY_DELTA as u32),
10191019
);
10201020
},
10211021
PackageSolvingData::HolderFundingOutput(_) => {

lightning/src/ln/monitor_tests.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,17 +2296,13 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool
22962296
}
22972297

22982298
// Connecting more blocks should result in the HTLC transactions being rebroadcast.
2299-
connect_blocks(&nodes[0], 6);
2299+
connect_blocks(&nodes[0], crate::chain::package::LOW_FREQUENCY_BUMP_INTERVAL);
23002300
if check_old_monitor_retries_after_upgrade {
23012301
check_added_monitors(&nodes[0], 1);
23022302
}
23032303
{
23042304
let txn = nodes[0].tx_broadcaster.txn_broadcast();
2305-
if !nodes[0].connect_style.borrow().skips_blocks() {
2306-
assert_eq!(txn.len(), 6);
2307-
} else {
2308-
assert!(txn.len() < 6);
2309-
}
2305+
assert_eq!(txn.len(), 1);
23102306
for tx in txn {
23112307
assert_eq!(tx.input.len(), htlc_timeout_tx.input.len());
23122308
assert_eq!(tx.output.len(), htlc_timeout_tx.output.len());
@@ -2420,9 +2416,9 @@ fn do_test_monitor_rebroadcast_pending_claims(anchors: bool) {
24202416
connect_blocks(&nodes[0], 1);
24212417
check_htlc_retry(true, false);
24222418

2423-
// Connect one more block, expecting a retry with a fee bump. Unfortunately, we cannot bump HTLC
2424-
// transactions pre-anchors.
2425-
connect_blocks(&nodes[0], 1);
2419+
// Connect a few more blocks, expecting a retry with a fee bump. Unfortunately, we cannot bump
2420+
// HTLC transactions pre-anchors.
2421+
connect_blocks(&nodes[0], crate::chain::package::LOW_FREQUENCY_BUMP_INTERVAL);
24262422
check_htlc_retry(true, anchors);
24272423

24282424
// Trigger a call and we should have another retry, but without a bump.
@@ -2434,20 +2430,13 @@ fn do_test_monitor_rebroadcast_pending_claims(anchors: bool) {
24342430
nodes[0].chain_monitor.chain_monitor.rebroadcast_pending_claims();
24352431
check_htlc_retry(true, anchors);
24362432

2437-
// Connect one more block, expecting a retry with a fee bump. Unfortunately, we cannot bump HTLC
2438-
// transactions pre-anchors.
2439-
connect_blocks(&nodes[0], 1);
2433+
// Connect a few more blocks, expecting a retry with a fee bump. Unfortunately, we cannot bump
2434+
// HTLC transactions pre-anchors.
2435+
connect_blocks(&nodes[0], crate::chain::package::LOW_FREQUENCY_BUMP_INTERVAL);
24402436
let htlc_tx = check_htlc_retry(true, anchors).unwrap();
24412437

24422438
// Mine the HTLC transaction to ensure we don't retry claims while they're confirmed.
24432439
mine_transaction(&nodes[0], &htlc_tx);
2444-
// If we have a `ConnectStyle` that advertises the new block first without the transactions,
2445-
// we'll receive an extra bumped claim.
2446-
if nodes[0].connect_style.borrow().updates_best_block_first() {
2447-
nodes[0].wallet_source.add_utxo(bitcoin::OutPoint { txid: coinbase_tx.compute_txid(), vout: 0 }, coinbase_tx.output[0].value);
2448-
nodes[0].wallet_source.remove_utxo(bitcoin::OutPoint { txid: htlc_tx.compute_txid(), vout: 1 });
2449-
check_htlc_retry(true, anchors);
2450-
}
24512440
nodes[0].chain_monitor.chain_monitor.rebroadcast_pending_claims();
24522441
check_htlc_retry(false, false);
24532442
}

lightning/src/ln/reorg_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,9 @@ fn do_test_retries_own_commitment_broadcast_after_reorg(anchors: bool, revoked_c
848848
{
849849
let mut txn = nodes[0].tx_broadcaster.txn_broadcast();
850850
if nodes[0].connect_style.borrow().updates_best_block_first() {
851-
// `commitment_a` and `htlc_timeout_a` are rebroadcast because the best block was
852-
// updated prior to seeing `commitment_b`.
853-
assert_eq!(txn.len(), if anchors { 2 } else { 3 });
851+
// `commitment_a` is rebroadcast because the best block was updated prior to seeing
852+
// `commitment_b`.
853+
assert_eq!(txn.len(), 2);
854854
check_spends!(txn.last().unwrap(), commitment_b);
855855
} else {
856856
assert_eq!(txn.len(), 1);

0 commit comments

Comments
 (0)