@@ -1284,7 +1284,7 @@ fn test_duplicate_htlc_different_direction_onchain() {
12841284 mine_transaction(&nodes[0], &remote_txn[0]);
12851285 check_added_monitors!(nodes[0], 1);
12861286 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
1287- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
1287+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
12881288
12891289 let claim_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
12901290 assert_eq!(claim_txn.len(), 3);
@@ -2438,7 +2438,7 @@ fn test_justice_tx_htlc_timeout() {
24382438 test_txn_broadcast(&nodes[1], &chan_5, Some(revoked_local_txn[0].clone()), HTLCType::NONE);
24392439
24402440 mine_transaction(&nodes[0], &revoked_local_txn[0]);
2441- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
2441+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
24422442 // Verify broadcast of revoked HTLC-timeout
24432443 let node_txn = test_txn_broadcast(&nodes[0], &chan_5, Some(revoked_local_txn[0].clone()), HTLCType::TIMEOUT);
24442444 check_added_monitors!(nodes[0], 1);
@@ -2765,7 +2765,7 @@ fn test_htlc_on_chain_success() {
27652765 // Verify that B's ChannelManager is able to extract preimage from HTLC Success tx and pass it backward
27662766 let header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[1].best_block_hash(), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42};
27672767 connect_block(&nodes[1], &Block { header, txdata: vec![commitment_tx[0].clone(), node_txn[0].clone(), node_txn[1].clone()]});
2768- connect_blocks(&nodes[1], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
2768+ connect_blocks(&nodes[1], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
27692769 {
27702770 let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
27712771 assert_eq!(added_monitors.len(), 1);
@@ -2894,15 +2894,15 @@ fn test_htlc_on_chain_success() {
28942894 assert_eq!(commitment_spend.input.len(), 2);
28952895 assert_eq!(commitment_spend.input[0].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
28962896 assert_eq!(commitment_spend.input[1].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
2897- assert_eq!(commitment_spend.lock_time.0, nodes[1].best_block_info().1 + 1 );
2897+ assert_eq!(commitment_spend.lock_time.0, nodes[1].best_block_info().1);
28982898 assert!(commitment_spend.output[0].script_pubkey.is_v0_p2wpkh()); // direct payment
28992899 // We don't bother to check that B can claim the HTLC output on its commitment tx here as
29002900 // we already checked the same situation with A.
29012901
29022902 // Verify that A's ChannelManager is able to extract preimage from preimage tx and generate PaymentSent
29032903 let mut header = BlockHeader { version: 0x20000000, prev_blockhash: nodes[0].best_block_hash(), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42};
29042904 connect_block(&nodes[0], &Block { header, txdata: vec![node_a_commitment_tx[0].clone(), commitment_spend.clone()] });
2905- connect_blocks(&nodes[0], TEST_FINAL_CLTV + MIN_CLTV_EXPIRY_DELTA as u32 - 1 ); // Confirm blocks until the HTLC expires
2905+ connect_blocks(&nodes[0], TEST_FINAL_CLTV + MIN_CLTV_EXPIRY_DELTA as u32); // Confirm blocks until the HTLC expires
29062906 check_closed_broadcast!(nodes[0], true);
29072907 check_added_monitors!(nodes[0], 1);
29082908 let events = nodes[0].node.get_and_clear_pending_events();
@@ -3024,7 +3024,7 @@ fn do_test_htlc_on_chain_timeout(connect_style: ConnectStyle) {
30243024 check_spends!(commitment_tx[0], chan_1.3);
30253025
30263026 mine_transaction(&nodes[0], &commitment_tx[0]);
3027- connect_blocks(&nodes[0], TEST_FINAL_CLTV + MIN_CLTV_EXPIRY_DELTA as u32 - 1 ); // Confirm blocks until the HTLC expires
3027+ connect_blocks(&nodes[0], TEST_FINAL_CLTV + MIN_CLTV_EXPIRY_DELTA as u32); // Confirm blocks until the HTLC expires
30283028
30293029 check_closed_broadcast!(nodes[0], true);
30303030 check_added_monitors!(nodes[0], 1);
@@ -4446,7 +4446,7 @@ fn test_static_spendable_outputs_timeout_tx() {
44464446 MessageSendEvent::BroadcastChannelUpdate { .. } => {},
44474447 _ => panic!("Unexpected event"),
44484448 }
4449- connect_blocks(&nodes[1], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
4449+ connect_blocks(&nodes[1], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
44504450
44514451 // Check B's monitor was able to send back output descriptor event for timeout tx on A's commitment tx
44524452 let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
@@ -4524,7 +4524,7 @@ fn test_static_spendable_outputs_justice_tx_revoked_htlc_timeout_tx() {
45244524 check_closed_broadcast!(nodes[0], true);
45254525 check_added_monitors!(nodes[0], 1);
45264526 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
4527- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
4527+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
45284528
45294529 let revoked_htlc_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
45304530 assert_eq!(revoked_htlc_txn.len(), 1);
@@ -4756,7 +4756,7 @@ fn test_onchain_to_onchain_claim() {
47564756 check_spends!(b_txn[0], commitment_tx[0]);
47574757 assert_eq!(b_txn[0].input[0].witness.clone().last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
47584758 assert!(b_txn[0].output[0].script_pubkey.is_v0_p2wpkh()); // direct payment
4759- assert_eq!(b_txn[0].lock_time.0, nodes[1].best_block_info().1 + 1 ); // Success tx
4759+ assert_eq!(b_txn[0].lock_time.0, nodes[1].best_block_info().1); // Success tx
47604760
47614761 check_closed_broadcast!(nodes[1], true);
47624762 check_added_monitors!(nodes[1], 1);
@@ -4807,7 +4807,7 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
48074807 check_closed_broadcast!(nodes[1], true);
48084808 check_added_monitors!(nodes[1], 1);
48094809 check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
4810- connect_blocks(&nodes[1], TEST_FINAL_CLTV - 40 + MIN_CLTV_EXPIRY_DELTA as u32 - 1 ); // Confirm blocks until the HTLC expires
4810+ connect_blocks(&nodes[1], TEST_FINAL_CLTV - 40 + MIN_CLTV_EXPIRY_DELTA as u32); // Confirm blocks until the HTLC expires
48114811
48124812 let htlc_timeout_tx;
48134813 { // Extract one of the two HTLC-Timeout transaction
@@ -5287,7 +5287,7 @@ fn test_dynamic_spendable_outputs_local_htlc_timeout_tx() {
52875287 check_closed_broadcast!(nodes[0], true);
52885288 check_added_monitors!(nodes[0], 1);
52895289 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
5290- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
5290+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
52915291
52925292 let htlc_timeout = {
52935293 let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
@@ -5370,7 +5370,7 @@ fn test_key_derivation_params() {
53705370
53715371 // Timeout HTLC on A's chain and so it can generate a HTLC-Timeout tx
53725372 mine_transaction(&nodes[0], &local_txn_1[0]);
5373- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
5373+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
53745374 check_closed_broadcast!(nodes[0], true);
53755375 check_added_monitors!(nodes[0], 1);
53765376 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
@@ -6927,7 +6927,7 @@ fn do_test_sweep_outbound_htlc_failure_update(revoked: bool, local: bool) {
69276927 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
69286928 assert_eq!(nodes[0].node.get_and_clear_pending_events().len(), 0);
69296929
6930- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
6930+ connect_blocks(&nodes[0], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
69316931 timeout_tx = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().drain(..)
69326932 .filter(|tx| tx.input[0].previous_output.txid == bs_commitment_tx[0].txid()).collect();
69336933 check_spends!(timeout_tx[0], bs_commitment_tx[0]);
@@ -6938,7 +6938,7 @@ fn do_test_sweep_outbound_htlc_failure_update(revoked: bool, local: bool) {
69386938 if !revoked {
69396939 assert_eq!(timeout_tx[0].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
69406940 } else {
6941- assert_eq!(timeout_tx[0].lock_time.0, 12 );
6941+ assert_eq!(timeout_tx[0].lock_time.0, 11 );
69426942 }
69436943 // We fail non-dust-HTLC 2 by broadcast of local timeout/revocation-claim tx
69446944 mine_transaction(&nodes[0], &timeout_tx[0]);
@@ -7318,7 +7318,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
73187318 check_closed_broadcast!(nodes[1], true);
73197319 check_added_monitors!(nodes[1], 1);
73207320 check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
7321- connect_blocks(&nodes[1], 49 ); // Confirm blocks until the HTLC expires (note CLTV was explicitly 50 above)
7321+ connect_blocks(&nodes[1], 50 ); // Confirm blocks until the HTLC expires (note CLTV was explicitly 50 above)
73227322
73237323 let revoked_htlc_txn = {
73247324 let txn = nodes[1].tx_broadcaster.unique_txn_broadcast();
@@ -7464,7 +7464,7 @@ fn test_bump_penalty_txn_on_remote_commitment() {
74647464 expect_payment_claimed!(nodes[1], payment_hash, 3_000_000);
74657465 mine_transaction(&nodes[1], &remote_txn[0]);
74667466 check_added_monitors!(nodes[1], 2);
7467- connect_blocks(&nodes[1], TEST_FINAL_CLTV - 1 ); // Confirm blocks until the HTLC expires
7467+ connect_blocks(&nodes[1], TEST_FINAL_CLTV); // Confirm blocks until the HTLC expires
74687468
74697469 // One or more claim tx should have been broadcast, check it
74707470 let timeout;
@@ -8660,7 +8660,7 @@ fn test_htlc_no_detection() {
86608660 check_closed_broadcast!(nodes[0], true);
86618661 check_added_monitors!(nodes[0], 1);
86628662 check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
8663- connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1 );
8663+ connect_blocks(&nodes[0], TEST_FINAL_CLTV);
86648664
86658665 let htlc_timeout = {
86668666 let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
@@ -9836,8 +9836,8 @@ fn test_non_final_funding_tx() {
98369836 assert_eq!(events.len(), 1);
98379837 let mut tx = match events[0] {
98389838 Event::FundingGenerationReady { ref channel_value_satoshis, ref output_script, .. } => {
9839- // Timelock the transaction _beyond_ the best client height + 2 .
9840- Transaction { version: chan_id as i32, lock_time: PackedLockTime(best_height + 3 ), input: vec![input], output: vec![TxOut {
9839+ // Timelock the transaction _beyond_ the best client height + 1 .
9840+ Transaction { version: chan_id as i32, lock_time: PackedLockTime(best_height + 2 ), input: vec![input], output: vec![TxOut {
98419841 value: *channel_value_satoshis, script_pubkey: output_script.clone(),
98429842 }]}
98439843 },
@@ -9851,7 +9851,7 @@ fn test_non_final_funding_tx() {
98519851 _ => panic!()
98529852 }
98539853
9854- // However, transaction should be accepted if it's in a +2 headroom from best block.
9854+ // However, transaction should be accepted if it's in a +1 headroom from best block.
98559855 tx.lock_time = PackedLockTime(tx.lock_time.0 - 1);
98569856 assert!(nodes[0].node.funding_transaction_generated(&temp_channel_id, &nodes[1].node.get_our_node_id(), tx.clone()).is_ok());
98579857 get_event_msg!(nodes[0], MessageSendEvent::SendFundingCreated, nodes[1].node.get_our_node_id());
0 commit comments