L: Deref,
> EventHandler for DecoratingEventHandler<'a, E, PGS, RGS, G, A, L>
where A::Target: chain::Access, L::Target: Logger {
- fn handle_event(&self, event: &Event) {
+ fn handle_event(&self, event: Event) {
if let Some(network_graph) = self.gossip_sync.network_graph() {
handle_network_graph_update(network_graph, &event)
}
begin_open_channel!($node_a, $node_b, $channel_value);
let events = $node_a.node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
- let (temporary_channel_id, tx) = handle_funding_generation_ready!(&events[0], $channel_value);
+ let (temporary_channel_id, tx) = handle_funding_generation_ready!(events[0], $channel_value);
end_open_channel!($node_a, $node_b, temporary_channel_id, tx);
tx
}}
macro_rules! handle_funding_generation_ready {
($event: expr, $channel_value: expr) => {{
match $event {
- &Event::FundingGenerationReady { temporary_channel_id, channel_value_satoshis, ref output_script, user_channel_id, .. } => {
+ Event::FundingGenerationReady { temporary_channel_id, channel_value_satoshis, ref output_script, user_channel_id, .. } => {
assert_eq!(channel_value_satoshis, $channel_value);
assert_eq!(user_channel_id, 42);
// Initiate the background processors to watch each node.
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].p2p_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
macro_rules! check_persisted_data {
let nodes = create_nodes(1, "test_timer_tick_called".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
loop {
let log_entries = nodes[0].logger.lines.lock().unwrap();
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir).with_manager_error(std::io::ErrorKind::Other, "test"));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
match bg_processor.join() {
Ok(_) => panic!("Expected error persisting manager"),
let nodes = create_nodes(2, "test_persist_network_graph_error".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir).with_graph_error(std::io::ErrorKind::Other, "test"));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].p2p_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
match bg_processor.stop() {
let nodes = create_nodes(2, "test_persist_scorer_error".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir).with_scorer_error(std::io::ErrorKind::Other, "test"));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
match bg_processor.stop() {
// Set up a background event handler for FundingGenerationReady events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
- let event_handler = move |event: &Event| match event {
+ let event_handler = move |event: Event| match event {
Event::FundingGenerationReady { .. } => sender.send(handle_funding_generation_ready!(event, channel_value)).unwrap(),
Event::ChannelReady { .. } => {},
_ => panic!("Unexpected event: {:?}", event),
// Set up a background event handler for SpendableOutputs events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
- let event_handler = move |event: &Event| match event {
+ let event_handler = move |event: Event| match event {
Event::SpendableOutputs { .. } => sender.send(event.clone()).unwrap(),
Event::ChannelReady { .. } => {},
Event::ChannelClosed { .. } => {},
let nodes = create_nodes(2, "test_scorer_persistence".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir));
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
loop {
assert!(original_graph_description.contains("42: features: 0000, node_one:"));
assert_eq!(network_graph.read_only().channels().len(), 1);
- let event_handler = |_: &_| {};
+ let event_handler = |_: _| {};
let background_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].rapid_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
loop {
let data_dir = nodes[0].persister.get_data_dir();
let persister = Arc::new(Persister::new(data_dir));
let router = DefaultRouter::new(Arc::clone(&nodes[0].network_graph), Arc::clone(&nodes[0].logger), random_seed_bytes, Arc::clone(&nodes[0].scorer));
- let invoice_payer = Arc::new(InvoicePayer::new(Arc::clone(&nodes[0].node), router, Arc::clone(&nodes[0].logger), |_: &_| {}, Retry::Attempts(2)));
+ let invoice_payer = Arc::new(InvoicePayer::new(Arc::clone(&nodes[0].node), router, Arc::clone(&nodes[0].logger), |_: _| {}, Retry::Attempts(2)));
let event_handler = Arc::clone(&invoice_payer);
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
assert!(bg_processor.stop().is_ok());
//! # }
//! #
//! # fn main() {
-//! let event_handler = |event: &Event| {
+//! let event_handler = |event: Event| {
//! match event {
//! Event::PaymentPathFailed { .. } => println!("payment failed after retries"),
//! Event::PaymentSent { .. } => println!("payment successful"),
P::Target: Payer,
L::Target: Logger,
{
- fn handle_event(&self, event: &Event) {
+ fn handle_event(&self, event: Event) {
let should_forward = self.handle_event_internal(&event);
if should_forward {
- self.event_handler.handle_event(&event)
+ self.event_handler.handle_event(event)
}
}
}
#[test]
fn pays_invoice_on_first_attempt() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
let payment_id = Some(invoice_payer.pay_invoice(&invoice).unwrap());
assert_eq!(*payer.attempts.borrow(), 1);
- invoice_payer.handle_event(&Event::PaymentSent {
+ invoice_payer.handle_event(Event::PaymentSent {
payment_id, payment_preimage, payment_hash, fee_paid_msat: None
});
assert_eq!(*event_handled.borrow(), true);
#[test]
fn pays_invoice_on_retry() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 2);
- invoice_payer.handle_event(&Event::PaymentSent {
+ invoice_payer.handle_event(Event::PaymentSent {
payment_id, payment_preimage, payment_hash, fee_paid_msat: None
});
assert_eq!(*event_handled.borrow(), true);
#[test]
fn pays_invoice_on_partial_failure() {
- let event_handler = |_: &Event| { panic!() };
+ let event_handler = |_: Event| { panic!() };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
#[test]
fn retries_payment_path_for_unknown_payment() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 1);
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 2);
- invoice_payer.handle_event(&Event::PaymentSent {
+ invoice_payer.handle_event(Event::PaymentSent {
payment_id, payment_preimage, payment_hash, fee_paid_msat: None
});
assert_eq!(*event_handled.borrow(), true);
#[test]
fn fails_paying_invoice_after_max_retry_counts() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 2);
final_value_msat: final_value_msat / 2, ..TestRouter::retry_for_invoice(&invoice)
}),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 3);
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 3);
}
#[test]
fn fails_paying_invoice_after_max_retry_timeout() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 2);
SinceEpoch::advance(Duration::from_secs(121));
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event.clone());
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 2);
}
#[test]
fn fails_paying_invoice_with_missing_retry_params() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: None,
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 1);
}
#[test]
fn fails_paying_invoice_after_expiration() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payer = TestPayer::new();
let router = TestRouter::new(TestScorer::new());
#[test]
fn fails_retrying_invoice_after_expiration() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(retry_data),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 1);
}
#[test]
fn fails_paying_invoice_after_retry_error() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 2);
}
#[test]
fn fails_paying_invoice_after_rejected_by_payee() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), true);
assert_eq!(*payer.attempts.borrow(), 1);
}
#[test]
fn fails_repaying_invoice_with_pending_payment() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id: None,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), true);
}
let router = FailingRouter {};
let logger = TestLogger::new();
let invoice_payer =
- InvoicePayer::new(&payer, router, &logger, |_: &Event| {}, Retry::Attempts(0));
+ InvoicePayer::new(&payer, router, &logger, |_: Event| {}, Retry::Attempts(0));
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
let router = TestRouter::new(TestScorer::new());
let logger = TestLogger::new();
let invoice_payer =
- InvoicePayer::new(&payer, router, &logger, |_: &Event| {}, Retry::Attempts(0));
+ InvoicePayer::new(&payer, router, &logger, |_: Event| {}, Retry::Attempts(0));
match invoice_payer.pay_invoice(&invoice) {
Err(PaymentError::Sending(_)) => {},
#[test]
fn pays_zero_value_invoice_using_amount() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = zero_value_invoice(payment_preimage);
Some(invoice_payer.pay_zero_value_invoice(&invoice, final_value_msat).unwrap());
assert_eq!(*payer.attempts.borrow(), 1);
- invoice_payer.handle_event(&Event::PaymentSent {
+ invoice_payer.handle_event(Event::PaymentSent {
payment_id, payment_preimage, payment_hash, fee_paid_msat: None
});
assert_eq!(*event_handled.borrow(), true);
#[test]
fn fails_paying_zero_value_invoice_with_amount() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payer = TestPayer::new();
let router = TestRouter::new(TestScorer::new());
#[test]
fn pays_pubkey_with_amount() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let pubkey = pubkey();
let payment_preimage = PaymentPreimage([1; 32]);
short_channel_id: None,
retry: Some(retry),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
assert_eq!(*event_handled.borrow(), false);
assert_eq!(*payer.attempts.borrow(), 2);
- invoice_payer.handle_event(&Event::PaymentSent {
+ invoice_payer.handle_event(Event::PaymentSent {
payment_id, payment_preimage, payment_hash, fee_paid_msat: None
});
assert_eq!(*event_handled.borrow(), true);
#[test]
fn scores_failed_channel() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
short_channel_id,
retry: Some(TestRouter::retry_for_invoice(&invoice)),
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
}
#[test]
fn scores_successful_channels() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
let event = Event::PaymentPathSuccessful {
payment_id, payment_hash, path: route.paths[0].clone()
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
let event = Event::PaymentPathSuccessful {
payment_id, payment_hash, path: route.paths[1].clone()
};
- invoice_payer.handle_event(&event);
+ invoice_payer.handle_event(event);
}
#[test]
fn generates_correct_inflight_map_data() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice = invoice(payment_preimage);
assert_eq!(inflight_map.0.get(&(3, false)).unwrap().clone(), 74);
assert_eq!(inflight_map.0.get(&(4, false)).unwrap().clone(), 64);
- invoice_payer.handle_event(&Event::PaymentPathSuccessful {
+ invoice_payer.handle_event(Event::PaymentPathSuccessful {
payment_id, payment_hash, path: route.paths[0].clone()
});
fn considers_inflight_htlcs_between_invoice_payments_when_path_succeeds() {
// First, let's just send a payment through, but only make sure one of the path completes
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let payment_invoice = invoice(payment_preimage);
// Succeed 1st path, leave 2nd path inflight
let payment_id = invoice_payer.pay_invoice(&payment_invoice).unwrap();
- invoice_payer.handle_event(&Event::PaymentPathSuccessful {
+ invoice_payer.handle_event(Event::PaymentPathSuccessful {
payment_id, payment_hash, path: route.paths[0].clone()
});
fn considers_inflight_htlcs_between_retries() {
// First, let's just send a payment through, but only make sure one of the path completes
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let payment_invoice = invoice(payment_preimage);
// Fail 1st path, leave 2nd path inflight
let payment_id = Some(invoice_payer.pay_invoice(&payment_invoice).unwrap());
- invoice_payer.handle_event(&Event::PaymentPathFailed {
+ invoice_payer.handle_event(Event::PaymentPathFailed {
payment_id,
payment_hash,
network_update: None,
});
// Fails again the 1st path of our retry
- invoice_payer.handle_event(&Event::PaymentPathFailed {
+ invoice_payer.handle_event(Event::PaymentPathFailed {
payment_id,
payment_hash,
network_update: None,
#[test]
fn accounts_for_some_inflight_htlcs_sent_during_partial_failure() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice_to_pay = invoice(payment_preimage);
#[test]
fn accounts_for_all_inflight_htlcs_sent_during_partial_failure() {
let event_handled = core::cell::RefCell::new(false);
- let event_handler = |_: &Event| { *event_handled.borrow_mut() = true; };
+ let event_handler = |_: Event| { *event_handled.borrow_mut() = true; };
let payment_preimage = PaymentPreimage([1; 32]);
let invoice_to_pay = invoice(payment_preimage);
route.paths[1][0].fee_msat = 50_000_000;
router.expect_find_route(Ok(route.clone()));
- let event_handler = |_: &Event| { panic!(); };
+ let event_handler = |_: Event| { panic!(); };
let invoice_payer = InvoicePayer::new(nodes[0].node, router, nodes[0].logger, event_handler, Retry::Attempts(1));
assert!(invoice_payer.pay_invoice(&create_invoice_from_channelmanager_and_duration_since_epoch(
route.paths[1][0].fee_msat = 50_000_001;
router.expect_find_route(Ok(route.clone()));
- let event_handler = |_: &Event| { panic!(); };
+ let event_handler = |_: Event| { panic!(); };
let invoice_payer = InvoicePayer::new(nodes[0].node, router, nodes[0].logger, event_handler, Retry::Attempts(1));
assert!(invoice_payer.pay_invoice(&create_invoice_from_channelmanager_and_duration_since_epoch(
route.paths.remove(1);
router.expect_find_route(Ok(route.clone()));
- let expected_events: RefCell<VecDeque<&dyn Fn(&Event)>> = RefCell::new(VecDeque::new());
- let event_handler = |event: &Event| {
+ let expected_events: RefCell<VecDeque<&dyn Fn(Event)>> = RefCell::new(VecDeque::new());
+ let event_handler = |event: Event| {
let event_checker = expected_events.borrow_mut().pop_front().unwrap();
event_checker(event);
};
// `PaymentPathFailed` being passed up to the user (us, in this case). Previously, we'd
// treated this as "HTLC complete" and dropped the retry counter, causing us to retry again
// if the final HTLC failed.
- expected_events.borrow_mut().push_back(&|ev: &Event| {
+ expected_events.borrow_mut().push_back(&|ev: Event| {
if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
assert!(!payment_failed_permanently);
assert!(all_paths_failed);
nodes[0].node.handle_update_fail_htlc(&nodes[1].node.get_our_node_id(), &bs_fail_update.update_fail_htlcs[0]);
commitment_signed_dance!(nodes[0], nodes[1], &bs_fail_update.commitment_signed, false, true);
- expected_events.borrow_mut().push_back(&|ev: &Event| {
+ expected_events.borrow_mut().push_back(&|ev: Event| {
if let Event::PaymentPathFailed { payment_failed_permanently, all_paths_failed, .. } = ev {
assert!(!payment_failed_permanently);
assert!(all_paths_failed);
} else { panic!("Unexpected event"); }
});
- expected_events.borrow_mut().push_back(&|ev: &Event| {
+ expected_events.borrow_mut().push_back(&|ev: Event| {
if let Event::PaymentFailed { .. } = ev {
} else { panic!("Unexpected event"); }
});