Skip to content

Commit a1644a2

Browse files
committed
Don't try to sign a revoked tx in test_data_loss_protect
1 parent 06e198c commit a1644a2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@ pub struct Node<'a, 'b: 'a, 'c: 'b> {
121121
pub network_payment_count: Rc<RefCell<u8>>,
122122
pub network_chan_count: Rc<RefCell<u32>>,
123123
pub logger: &'c test_utils::TestLogger,
124+
pub is_failed: bool,
124125
}
125126

126127
impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
127128
fn drop(&mut self) {
128-
if !::std::thread::panicking() {
129+
if !::std::thread::panicking() && !self.is_failed {
129130
// Check that we processed all pending events
130131
assert!(self.node.get_and_clear_pending_msg_events().is_empty());
131132
assert!(self.node.get_and_clear_pending_events().is_empty());
@@ -1180,7 +1181,7 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec<NodeC
11801181
tx_broadcaster: cfgs[i].tx_broadcaster, chain_monitor: &cfgs[i].chain_monitor,
11811182
keys_manager: &cfgs[i].keys_manager, node: &chan_mgrs[i], net_graph_msg_handler,
11821183
node_seed: cfgs[i].node_seed, network_chan_count: chan_count.clone(),
1183-
network_payment_count: payment_count.clone(), logger: cfgs[i].logger,
1184+
network_payment_count: payment_count.clone(), logger: cfgs[i].logger, is_failed: false
11841185
})
11851186
}
11861187

lightning/src/ln/functional_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7475,6 +7475,9 @@ fn test_data_loss_protect() {
74757475
let spend_txn = check_spendable_outputs!(nodes[0], 1, node_cfgs[0].keys_manager, 100000);
74767476
assert_eq!(spend_txn.len(), 1);
74777477
check_spends!(spend_txn[0], node_txn[0]);
7478+
7479+
// Mark node as failed so we don't execute Node::drop and panic trying to sign a revoked tx
7480+
nodes[0].is_failed = true;
74787481
}
74797482

74807483
#[test]

0 commit comments

Comments
 (0)