Skip to content

Commit c5ce61b

Browse files
committed
Remove remaining (now-redundant) manual-broadcast tests
The remaining two manual-broadcast tests were made redundant by the previous commit which expanded the coverage of the first test. Thus we remove the two other tests.
1 parent 61282d6 commit c5ce61b

File tree

1 file changed

+0
-118
lines changed

1 file changed

+0
-118
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use crate::chain::channelmonitor::{
2020
};
2121
use crate::chain::transaction::OutPoint;
2222
use crate::chain::{ChannelMonitorUpdateStatus, Confirm, Listen, Watch};
23-
use crate::events::bump_transaction::BumpTransactionEvent;
2423
use crate::events::{
2524
ClosureReason, Event, HTLCHandlingFailureType, PathFailure, PaymentFailureReason,
2625
PaymentPurpose,
@@ -9743,123 +9742,6 @@ fn test_manual_broadcast_skips_commitment_until_funding() {
97439742
do_test_manual_broadcast_skips_commitment_until_funding(false, false, false);
97449743
}
97459744

9746-
#[test]
9747-
fn test_manual_broadcast_detects_funding_and_broadcasts_on_timeout() {
9748-
let chanmon_cfgs = create_chanmon_cfgs(2);
9749-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
9750-
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
9751-
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
9752-
9753-
let node_b_id = nodes[1].node.get_our_node_id();
9754-
9755-
let (channel_id, funding_tx, funding_outpoint) =
9756-
create_channel_manual_funding(&nodes, 0, 1, 100_000, 10_000, false);
9757-
9758-
let funding_msgs =
9759-
create_chan_between_nodes_with_value_confirm(&nodes[0], &nodes[1], &funding_tx);
9760-
let confirmed_channel_id = funding_msgs.1;
9761-
assert_eq!(confirmed_channel_id, channel_id);
9762-
let _announcements =
9763-
create_chan_between_nodes_with_value_b(&nodes[0], &nodes[1], &funding_msgs.0);
9764-
9765-
let usable_channels = nodes[0].node.list_usable_channels();
9766-
assert_eq!(usable_channels.len(), 1);
9767-
assert_eq!(usable_channels[0].channel_id, channel_id);
9768-
9769-
let (_payment_preimage, _payment_hash, _payment_secret, _payment_id) =
9770-
route_payment(&nodes[0], &[&nodes[1]], 10_000_000);
9771-
nodes[1].node.get_and_clear_pending_events();
9772-
9773-
connect_blocks(&nodes[0], TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + 1);
9774-
connect_blocks(&nodes[1], TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + 1);
9775-
9776-
let events = nodes[0].node.get_and_clear_pending_events();
9777-
assert!(events.iter().any(|event| matches!(
9778-
event,
9779-
Event::ChannelClosed {
9780-
reason: ClosureReason::HTLCsTimedOut { .. },
9781-
counterparty_node_id: Some(id),
9782-
..
9783-
} if id == &node_b_id
9784-
)));
9785-
nodes[1].node.get_and_clear_pending_events();
9786-
nodes[0].node.get_and_clear_pending_msg_events();
9787-
nodes[1].node.get_and_clear_pending_msg_events();
9788-
check_added_monitors!(&nodes[0], 1);
9789-
check_added_monitors!(&nodes[1], 0);
9790-
9791-
let funding_txid = funding_tx.compute_txid();
9792-
let broadcasts = nodes[0].tx_broadcaster.txn_broadcast();
9793-
assert!(!broadcasts.is_empty());
9794-
let commitment_tx = broadcasts
9795-
.iter()
9796-
.find(|tx| {
9797-
tx.input.iter().any(|input| {
9798-
input.previous_output.txid == funding_txid
9799-
&& input.previous_output.vout == u32::from(funding_outpoint.index)
9800-
})
9801-
})
9802-
.expect("commitment transaction not broadcast");
9803-
check_spends!(commitment_tx, funding_tx);
9804-
assert_eq!(commitment_tx.input.len(), 1);
9805-
9806-
for event in nodes[0].chain_monitor.chain_monitor.get_and_clear_pending_events() {
9807-
if let Event::BumpTransaction(bump_event) = event {
9808-
if let BumpTransactionEvent::ChannelClose {
9809-
channel_id: event_channel_id,
9810-
counterparty_node_id,
9811-
..
9812-
} = &bump_event
9813-
{
9814-
assert_eq!(*event_channel_id, channel_id);
9815-
assert_eq!(*counterparty_node_id, node_b_id);
9816-
}
9817-
nodes[0].bump_tx_handler.handle_event(&bump_event);
9818-
}
9819-
}
9820-
}
9821-
9822-
#[test]
9823-
fn test_manual_broadcast_no_bump_events_before_funding_seen() {
9824-
let chanmon_cfgs = create_chanmon_cfgs(2);
9825-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
9826-
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
9827-
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
9828-
9829-
let node_b_id = nodes[1].node.get_our_node_id();
9830-
9831-
let (channel_id, _, _) = create_channel_manual_funding(&nodes, 0, 1, 100_000, 10_000, false);
9832-
9833-
nodes[0]
9834-
.node
9835-
.force_close_broadcasting_latest_txn(&channel_id, &node_b_id, "manual close".to_owned())
9836-
.unwrap();
9837-
check_added_monitors!(&nodes[0], 1);
9838-
check_added_monitors!(&nodes[1], 0);
9839-
9840-
assert!(nodes[0].tx_broadcaster.txn_broadcast().is_empty());
9841-
nodes[0].node.get_and_clear_pending_msg_events();
9842-
nodes[1].node.get_and_clear_pending_msg_events();
9843-
let events = nodes[0].node.get_and_clear_pending_events();
9844-
assert_eq!(events.len(), 1);
9845-
match &events[0] {
9846-
Event::ChannelClosed {
9847-
reason: ClosureReason::HolderForceClosed { broadcasted_latest_txn, message },
9848-
counterparty_node_id: Some(id),
9849-
..
9850-
} => {
9851-
assert_eq!(*broadcasted_latest_txn, Some(true));
9852-
assert_eq!(message, "manual close");
9853-
assert_eq!(id, &node_b_id);
9854-
},
9855-
_ => panic!("Unexpected event"),
9856-
}
9857-
nodes[1].node.get_and_clear_pending_events();
9858-
9859-
let monitor_events = nodes[0].chain_monitor.chain_monitor.get_and_clear_pending_events();
9860-
assert!(monitor_events.iter().all(|event| !matches!(event, Event::BumpTransaction(_))));
9861-
}
9862-
98639745
fn do_test_multi_post_event_actions(do_reload: bool) {
98649746
// Tests handling multiple post-Event actions at once.
98659747
// There is specific code in ChannelManager to handle channels where multiple post-Event

0 commit comments

Comments
 (0)