Skip to content

Commit 6120719

Browse files
author
Antoine Riard
committed
Bump default CSV delay on counterparty states to 7 days of blocks
1 parent 8a8f29a commit 6120719

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

lightning/src/ln/functional_tests.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -2402,11 +2402,11 @@ fn test_justice_tx_htlc_timeout() {
24022402
let mut alice_config = UserConfig::default();
24032403
alice_config.channel_handshake_config.announced_channel = true;
24042404
alice_config.channel_handshake_limits.force_announced_channel_preference = false;
2405-
alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
2405+
alice_config.channel_handshake_config.our_to_self_delay = 1008 + 288;
24062406
let mut bob_config = UserConfig::default();
24072407
bob_config.channel_handshake_config.announced_channel = true;
24082408
bob_config.channel_handshake_limits.force_announced_channel_preference = false;
2409-
bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
2409+
bob_config.channel_handshake_config.our_to_self_delay = 1008 + 144;
24102410
let user_cfgs = [Some(alice_config), Some(bob_config)];
24112411
let mut chanmon_cfgs = create_chanmon_cfgs(2);
24122412
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
@@ -2465,11 +2465,11 @@ fn test_justice_tx_htlc_success() {
24652465
let mut alice_config = UserConfig::default();
24662466
alice_config.channel_handshake_config.announced_channel = true;
24672467
alice_config.channel_handshake_limits.force_announced_channel_preference = false;
2468-
alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
2468+
alice_config.channel_handshake_config.our_to_self_delay = 1008 + 288;
24692469
let mut bob_config = UserConfig::default();
24702470
bob_config.channel_handshake_config.announced_channel = true;
24712471
bob_config.channel_handshake_limits.force_announced_channel_preference = false;
2472-
bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
2472+
bob_config.channel_handshake_config.our_to_self_delay = 1008 + 144;
24732473
let user_cfgs = [Some(alice_config), Some(bob_config)];
24742474
let mut chanmon_cfgs = create_chanmon_cfgs(2);
24752475
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
@@ -4306,13 +4306,13 @@ fn test_claim_sizeable_push_msat() {
43064306
assert_eq!(node_txn[0].output.len(), 2); // We can't force trimming of to_remote output as channel_reserve_satoshis block us to do so at channel opening
43074307

43084308
mine_transaction(&nodes[1], &node_txn[0]);
4309-
connect_blocks(&nodes[1], BREAKDOWN_TIMEOUT as u32 - 1);
4309+
connect_blocks(&nodes[1], (BREAKDOWN_TIMEOUT * 7) as u32 - 1);
43104310

43114311
let spend_txn = check_spendable_outputs!(nodes[1], node_cfgs[1].keys_manager);
43124312
assert_eq!(spend_txn.len(), 1);
43134313
assert_eq!(spend_txn[0].input.len(), 1);
43144314
check_spends!(spend_txn[0], node_txn[0]);
4315-
assert_eq!(spend_txn[0].input[0].sequence.0, BREAKDOWN_TIMEOUT as u32);
4315+
assert_eq!(spend_txn[0].input[0].sequence.0, (BREAKDOWN_TIMEOUT * 7) as u32);
43164316
}
43174317

43184318
#[test]
@@ -4955,14 +4955,14 @@ fn test_dynamic_spendable_outputs_local_htlc_success_tx() {
49554955
};
49564956

49574957
mine_transaction(&nodes[1], &node_tx);
4958-
connect_blocks(&nodes[1], BREAKDOWN_TIMEOUT as u32 - 1);
4958+
connect_blocks(&nodes[1], (BREAKDOWN_TIMEOUT * 7) as u32 - 1);
49594959

49604960
// Verify that B is able to spend its own HTLC-Success tx thanks to spendable output event given back by its ChannelMonitor
49614961
let spend_txn = check_spendable_outputs!(nodes[1], node_cfgs[1].keys_manager);
49624962
assert_eq!(spend_txn.len(), 1);
49634963
assert_eq!(spend_txn[0].input.len(), 1);
49644964
check_spends!(spend_txn[0], node_tx);
4965-
assert_eq!(spend_txn[0].input[0].sequence.0, BREAKDOWN_TIMEOUT as u32);
4965+
assert_eq!(spend_txn[0].input[0].sequence.0, (BREAKDOWN_TIMEOUT * 7) as u32);
49664966
}
49674967

49684968
fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, announce_latest: bool) {
@@ -5303,7 +5303,7 @@ fn test_dynamic_spendable_outputs_local_htlc_timeout_tx() {
53035303
};
53045304

53055305
mine_transaction(&nodes[0], &htlc_timeout);
5306-
connect_blocks(&nodes[0], BREAKDOWN_TIMEOUT as u32 - 1);
5306+
connect_blocks(&nodes[0], (BREAKDOWN_TIMEOUT * 7) as u32 - 1);
53075307
expect_payment_failed!(nodes[0], our_payment_hash, false);
53085308

53095309
// Verify that A is able to spend its own HTLC-Timeout tx thanks to spendable output event given back by its ChannelMonitor
@@ -5312,11 +5312,11 @@ fn test_dynamic_spendable_outputs_local_htlc_timeout_tx() {
53125312
check_spends!(spend_txn[0], local_txn[0]);
53135313
assert_eq!(spend_txn[1].input.len(), 1);
53145314
check_spends!(spend_txn[1], htlc_timeout);
5315-
assert_eq!(spend_txn[1].input[0].sequence.0, BREAKDOWN_TIMEOUT as u32);
5315+
assert_eq!(spend_txn[1].input[0].sequence.0, (BREAKDOWN_TIMEOUT * 7) as u32);
53165316
assert_eq!(spend_txn[2].input.len(), 2);
53175317
check_spends!(spend_txn[2], local_txn[0], htlc_timeout);
5318-
assert!(spend_txn[2].input[0].sequence.0 == BREAKDOWN_TIMEOUT as u32 ||
5319-
spend_txn[2].input[1].sequence.0 == BREAKDOWN_TIMEOUT as u32);
5318+
assert!(spend_txn[2].input[0].sequence.0 == (BREAKDOWN_TIMEOUT * 7) as u32 ||
5319+
spend_txn[2].input[1].sequence.0 == (BREAKDOWN_TIMEOUT * 7) as u32);
53205320
}
53215321

53225322
#[test]
@@ -5389,7 +5389,7 @@ fn test_key_derivation_params() {
53895389
};
53905390

53915391
mine_transaction(&nodes[0], &htlc_timeout);
5392-
connect_blocks(&nodes[0], BREAKDOWN_TIMEOUT as u32 - 1);
5392+
connect_blocks(&nodes[0], (BREAKDOWN_TIMEOUT * 7) as u32 - 1);
53935393
expect_payment_failed!(nodes[0], our_payment_hash, false);
53945394

53955395
// Verify that A is able to spend its own HTLC-Timeout tx thanks to spendable output event given back by its ChannelMonitor
@@ -5399,11 +5399,11 @@ fn test_key_derivation_params() {
53995399
check_spends!(spend_txn[0], local_txn_1[0]);
54005400
assert_eq!(spend_txn[1].input.len(), 1);
54015401
check_spends!(spend_txn[1], htlc_timeout);
5402-
assert_eq!(spend_txn[1].input[0].sequence.0, BREAKDOWN_TIMEOUT as u32);
5402+
assert_eq!(spend_txn[1].input[0].sequence.0, (BREAKDOWN_TIMEOUT * 7) as u32);
54035403
assert_eq!(spend_txn[2].input.len(), 2);
54045404
check_spends!(spend_txn[2], local_txn_1[0], htlc_timeout);
5405-
assert!(spend_txn[2].input[0].sequence.0 == BREAKDOWN_TIMEOUT as u32 ||
5406-
spend_txn[2].input[1].sequence.0 == BREAKDOWN_TIMEOUT as u32);
5405+
assert!(spend_txn[2].input[0].sequence.0 == (BREAKDOWN_TIMEOUT * 7) as u32 ||
5406+
spend_txn[2].input[1].sequence.0 == (BREAKDOWN_TIMEOUT * 7) as u32);
54075407
}
54085408

54095409
#[test]
@@ -5635,8 +5635,8 @@ fn bolt2_open_channel_sending_node_checks_part2() {
56355635
assert!(node0_to_1_send_open_channel.channel_flags<=1);
56365636

56375637
// BOLT #2 spec: Sending node should set to_self_delay sufficient to ensure the sender can irreversibly spend a commitment transaction output, in case of misbehaviour by the receiver.
5638-
assert!(BREAKDOWN_TIMEOUT>0);
5639-
assert!(node0_to_1_send_open_channel.to_self_delay==BREAKDOWN_TIMEOUT);
5638+
assert!((BREAKDOWN_TIMEOUT*7)>0);
5639+
assert!(node0_to_1_send_open_channel.to_self_delay==(BREAKDOWN_TIMEOUT*7));
56405640

56415641
// BOLT #2 spec: Sending node must ensure the chain_hash value identifies the chain it wishes to open the channel within.
56425642
let chain_hash=genesis_block(Network::Testnet).header.block_hash();
@@ -9122,7 +9122,7 @@ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast(test_height_before_t
91229122

91239123
let conf_height = nodes[1].best_block_info().1;
91249124
if !test_height_before_timelock {
9125-
connect_blocks(&nodes[1], 24 * 6);
9125+
connect_blocks(&nodes[1], (BREAKDOWN_TIMEOUT*7) as u32);
91269126
}
91279127
nodes[1].chain_monitor.chain_monitor.transactions_confirmed(
91289128
&nodes[1].get_block_header(conf_height), &[(0, &node_txn[0])], conf_height);

0 commit comments

Comments
 (0)