From: Matt Corallo Date: Fri, 18 Nov 2022 18:49:16 +0000 (+0000) Subject: Fix one test still connecting invalid blocks X-Git-Tag: v0.0.113~28^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=4883eba3ae96aacb4c6871805a86bee7a519aac2;p=rust-lightning Fix one test still connecting invalid blocks In the next commit we'll add some checks that redundant transactions aren't confirmed in different blocks, which would cause test_htlc_ignore_latest_remote_commitment to fail. Here we fix it to avoid the issue. --- diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index 125c9bea9..33eec98c0 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -3370,6 +3370,12 @@ fn test_htlc_ignore_latest_remote_commitment() { let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let nodes = create_network(2, &node_cfgs, &node_chanmgrs); + if *nodes[1].connect_style.borrow() == ConnectStyle::FullBlockViaListen { + // We rely on the ability to connect a block redundantly, which isn't allowed via + // `chain::Listen`, so we never run the test if we randomly get assigned that + // connect_style. + return; + } create_announced_chan_between_nodes(&nodes, 0, 1, channelmanager::provided_init_features(), channelmanager::provided_init_features()); route_payment(&nodes[0], &[&nodes[1]], 10000000); @@ -3391,7 +3397,6 @@ fn test_htlc_ignore_latest_remote_commitment() { // Duplicate the connect_block call since this may happen due to other listeners // registering new transactions - header.prev_blockhash = header.block_hash(); connect_block(&nodes[1], &Block { header, txdata: vec![node_txn[0].clone(), node_txn[2].clone()]}); }