+ end_open_channel!(nodes[0], nodes[1], temporary_channel_id, funding_tx);
+
+ // Confirm the funding transaction.
+ confirm_transaction(&mut nodes[0], &funding_tx);
+ confirm_transaction(&mut nodes[1], &funding_tx);
+ nodes[0].node.handle_funding_locked(&nodes[1].node.get_our_node_id(), &get_event_msg!(nodes[1], MessageSendEvent::SendFundingLocked, nodes[0].node.get_our_node_id()));
+ nodes[1].node.handle_funding_locked(&nodes[0].node.get_our_node_id(), &get_event_msg!(nodes[0], MessageSendEvent::SendFundingLocked, nodes[1].node.get_our_node_id()));
+
+ assert!(bg_processor.stop().is_ok());
+
+ // Set up a background event handler for SpendableOutputs events.
+ let (sender, receiver) = std::sync::mpsc::sync_channel(1);
+ let event_handler = move |event| sender.send(event).unwrap();
+ let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
+
+ // Force close the channel and check that the SpendableOutputs event was handled.
+ nodes[0].node.force_close_channel(&nodes[0].node.list_channels()[0].channel_id).unwrap();
+ let commitment_tx = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().pop().unwrap();
+ confirm_transaction(&mut nodes[0], &commitment_tx);
+ let event = receiver
+ .recv_timeout(Duration::from_secs(EVENT_DEADLINE))
+ .expect("SpendableOutputs not handled within deadline");
+ match event {
+ Event::SpendableOutputs { .. } => {},
+ _ => panic!("Unexpected event: {:?}", event),
+ }