}}
}
+macro_rules! expect_payment_received {
+ ($node: expr, $expected_payment_hash: expr, $expected_recv_value: expr) => {
+ let events = $node.node.get_and_clear_pending_events();
+ assert_eq!(events.len(), 1);
+ match events[0] {
+ Event::PaymentReceived { ref payment_hash, amt } => {
+ assert_eq!($expected_payment_hash, *payment_hash);
+ assert_eq!($expected_recv_value, amt);
+ },
+ _ => panic!("Unexpected event"),
+ }
+ }
+}
+
+macro_rules! expect_payment_sent {
+ ($node: expr, $expected_payment_preimage: expr) => {
+ let events = $node.node.get_and_clear_pending_events();
+ assert_eq!(events.len(), 1);
+ match events[0] {
+ Event::PaymentSent { ref payment_preimage } => {
+ assert_eq!($expected_payment_preimage, *payment_preimage);
+ },
+ _ => panic!("Unexpected event"),
+ }
+ }
+}
+
pub fn send_along_route_with_hash(origin_node: &Node, route: Route, expected_route: &[&Node], recv_value: u64, our_payment_hash: PaymentHash) {
let mut payment_event = {
origin_node.node.send_payment(route, our_payment_hash).unwrap();
if !skip_last {
last_update_fulfill_dance!(origin_node, expected_route.first().unwrap());
- let events = origin_node.node.get_and_clear_pending_events();
- assert_eq!(events.len(), 1);
- match events[0] {
- Event::PaymentSent { payment_preimage } => {
- assert_eq!(payment_preimage, our_payment_preimage);
- },
- _ => panic!("Unexpected event"),
- }
+ expect_payment_sent!(origin_node, our_payment_preimage);
}
}
}
}
-macro_rules! expect_payment_received {
- ($node: expr, $expected_payment_hash: expr, $expected_recv_value: expr) => {
- let events = $node.node.get_and_clear_pending_events();
- assert_eq!(events.len(), 1);
- match events[0] {
- Event::PaymentReceived { ref payment_hash, amt } => {
- assert_eq!($expected_payment_hash, *payment_hash);
- assert_eq!($expected_recv_value, amt);
- },
- _ => panic!("Unexpected event"),
- }
- }
-}
-
macro_rules! get_channel_value_stat {
($node: expr, $channel_id: expr) => {{
let chan_lock = $node.node.channel_state.lock().unwrap();