/// * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
/// writing it to disk/backups by invoking the callback given to it at startup.
/// ChannelManager persistence should be done in the background.
-/// * Calling `ChannelManager::timer_chan_freshness_every_min()` every minute (can be done in the
+/// * Calling `ChannelManager::timer_tick_occurred()` every minute (can be done in the
/// background).
///
/// Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
return Ok(());
}
if current_time.elapsed().as_secs() > CHAN_FRESHNESS_TIMER {
- log_trace!(logger, "Calling manager's timer_chan_freshness_every_min");
- channel_manager.timer_chan_freshness_every_min();
+ log_trace!(logger, "Calling manager's timer_tick_occurred");
+ channel_manager.timer_tick_occurred();
current_time = Instant::now();
}
}
$node_a.node.handle_accept_channel(&$node_b.node.get_our_node_id(), InitFeatures::known(), &get_event_msg!($node_b, MessageSendEvent::SendAcceptChannel, $node_a.node.get_our_node_id()));
let events = $node_a.node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
- let (temporary_channel_id, tx, funding_output) = match events[0] {
+ let (temporary_channel_id, tx) = match events[0] {
Event::FundingGenerationReady { ref temporary_channel_id, ref channel_value_satoshis, ref output_script, user_channel_id } => {
assert_eq!(*channel_value_satoshis, $channel_value);
assert_eq!(user_channel_id, 42);
let tx = Transaction { version: 1 as i32, lock_time: 0, input: Vec::new(), output: vec![TxOut {
value: *channel_value_satoshis, script_pubkey: output_script.clone(),
}]};
- let funding_outpoint = OutPoint { txid: tx.txid(), index: 0 };
- (*temporary_channel_id, tx, funding_outpoint)
+ (*temporary_channel_id, tx)
},
_ => panic!("Unexpected event"),
};
- $node_a.node.funding_transaction_generated(&temporary_channel_id, funding_output);
+ $node_a.node.funding_transaction_generated(&temporary_channel_id, tx.clone()).unwrap();
$node_b.node.handle_funding_created(&$node_a.node.get_our_node_id(), &get_event_msg!($node_a, MessageSendEvent::SendFundingCreated, $node_b.node.get_our_node_id()));
$node_a.node.handle_funding_signed(&$node_b.node.get_our_node_id(), &get_event_msg!($node_b, MessageSendEvent::SendFundingSigned, $node_a.node.get_our_node_id()));
tx
}
#[test]
- fn test_chan_freshness_called() {
- // Test that ChannelManager's `timer_chan_freshness_every_min` is called every
+ fn test_timer_tick_called() {
+ // Test that ChannelManager's `timer_tick_occurred` is called every
// `CHAN_FRESHNESS_TIMER`.
let nodes = create_nodes(1, "test_chan_freshness_called".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let bg_processor = BackgroundProcessor::start(callback, nodes[0].node.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
loop {
let log_entries = nodes[0].logger.lines.lock().unwrap();
- let desired_log = "Calling manager's timer_chan_freshness_every_min".to_string();
+ let desired_log = "Calling manager's timer_tick_occurred".to_string();
if log_entries.get(&("lightning_background_processor".to_string(), desired_log)).is_some() {
break
}