@@ -286,7 +286,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
286
286
let mut channel_txn = Vec :: new ( ) ;
287
287
macro_rules! make_channel {
288
288
( $source: expr, $dest: expr, $chan_id: expr) => { {
289
- $source. create_channel( $dest. get_our_node_id( ) , 10000000 , 42 , 0 , None ) . unwrap( ) ;
289
+ $source. create_channel( $dest. get_our_node_id( ) , 100_000 , 42 , 0 , None ) . unwrap( ) ;
290
290
let open_channel = {
291
291
let events = $source. get_and_clear_pending_msg_events( ) ;
292
292
assert_eq!( events. len( ) , 1 ) ;
@@ -498,28 +498,28 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
498
498
node_features: NodeFeatures :: empty( ) ,
499
499
short_channel_id: $middle. 1 ,
500
500
channel_features: ChannelFeatures :: empty( ) ,
501
- fee_msat: 50000 ,
501
+ fee_msat: 50_000 ,
502
502
cltv_expiry_delta: 100 ,
503
503
} , RouteHop {
504
504
pubkey: $dest. 0 . get_our_node_id( ) ,
505
505
node_features: NodeFeatures :: empty( ) ,
506
506
short_channel_id: $dest. 1 ,
507
507
channel_features: ChannelFeatures :: empty( ) ,
508
- fee_msat: 5000000 ,
508
+ fee_msat: 10_000_000 ,
509
509
cltv_expiry_delta: 200 ,
510
510
} ] , vec![ RouteHop {
511
511
pubkey: $middle. 0 . get_our_node_id( ) ,
512
512
node_features: NodeFeatures :: empty( ) ,
513
513
short_channel_id: $middle. 1 ,
514
514
channel_features: ChannelFeatures :: empty( ) ,
515
- fee_msat: 50000 ,
515
+ fee_msat: 50_000 ,
516
516
cltv_expiry_delta: 100 ,
517
517
} , RouteHop {
518
518
pubkey: $dest. 0 . get_our_node_id( ) ,
519
519
node_features: NodeFeatures :: empty( ) ,
520
520
short_channel_id: $dest. 1 ,
521
521
channel_features: ChannelFeatures :: empty( ) ,
522
- fee_msat: 5000000 ,
522
+ fee_msat: 10_000_000 ,
523
523
cltv_expiry_delta: 200 ,
524
524
} ] ] ,
525
525
} , PaymentHash ( payment_hash. into_inner( ) ) , & Some ( PaymentSecret ( payment_secret. into_inner( ) ) ) ) {
@@ -700,81 +700,83 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
700
700
}
701
701
702
702
match get_slice ! ( 1 ) [ 0 ] {
703
+ // In general, we keep related message groups close together in binary form, allowing
704
+ // bit-twiddling mutations to have similar effects. This is probably overkill, but no
705
+ // harm in doing so.
706
+
703
707
0x00 => * monitor_a. update_ret . lock ( ) . unwrap ( ) = Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ,
704
708
0x01 => * monitor_b. update_ret . lock ( ) . unwrap ( ) = Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ,
705
709
0x02 => * monitor_c. update_ret . lock ( ) . unwrap ( ) = Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ,
706
- 0x03 => * monitor_a. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
707
- 0x04 => * monitor_b. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
708
- 0x05 => * monitor_c. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
709
- 0x06 => {
710
+ 0x04 => * monitor_a. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
711
+ 0x05 => * monitor_b. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
712
+ 0x06 => * monitor_c. update_ret . lock ( ) . unwrap ( ) = Ok ( ( ) ) ,
713
+
714
+ 0x08 => {
710
715
if let Some ( ( id, _) ) = monitor_a. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
711
716
nodes[ 0 ] . channel_monitor_updated ( & chan_1_funding, * id) ;
712
717
}
713
718
} ,
714
- 0x07 => {
719
+ 0x09 => {
715
720
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_1_funding) {
716
721
nodes[ 1 ] . channel_monitor_updated ( & chan_1_funding, * id) ;
717
722
}
718
723
} ,
719
- 0x24 => {
724
+ 0x0a => {
720
725
if let Some ( ( id, _) ) = monitor_b. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
721
726
nodes[ 1 ] . channel_monitor_updated ( & chan_2_funding, * id) ;
722
727
}
723
728
} ,
724
- 0x08 => {
729
+ 0x0b => {
725
730
if let Some ( ( id, _) ) = monitor_c. latest_monitors . lock ( ) . unwrap ( ) . get ( & chan_2_funding) {
726
731
nodes[ 2 ] . channel_monitor_updated ( & chan_2_funding, * id) ;
727
732
}
728
733
} ,
729
- 0x09 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 5_000_000 ) ,
730
- 0x0a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 5_000_000 ) ,
731
- 0x0b => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 5_000_000 ) ,
732
- 0x0c => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 5_000_000 ) ,
733
- 0x0d => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 5_000_000 ) ,
734
- 0x0e => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 5_000_000 ) ,
735
- 0x0f => {
734
+
735
+ 0x0c => {
736
736
if !chan_a_disconnected {
737
737
nodes[ 0 ] . peer_disconnected ( & nodes[ 1 ] . get_our_node_id ( ) , false ) ;
738
738
nodes[ 1 ] . peer_disconnected ( & nodes[ 0 ] . get_our_node_id ( ) , false ) ;
739
739
chan_a_disconnected = true ;
740
740
drain_msg_events_on_disconnect ! ( 0 ) ;
741
741
}
742
742
} ,
743
- 0x10 => {
743
+ 0x0d => {
744
744
if !chan_b_disconnected {
745
745
nodes[ 1 ] . peer_disconnected ( & nodes[ 2 ] . get_our_node_id ( ) , false ) ;
746
746
nodes[ 2 ] . peer_disconnected ( & nodes[ 1 ] . get_our_node_id ( ) , false ) ;
747
747
chan_b_disconnected = true ;
748
748
drain_msg_events_on_disconnect ! ( 2 ) ;
749
749
}
750
750
} ,
751
- 0x11 => {
751
+ 0x0e => {
752
752
if chan_a_disconnected {
753
753
nodes[ 0 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & Init { features : InitFeatures :: empty ( ) } ) ;
754
754
nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & Init { features : InitFeatures :: empty ( ) } ) ;
755
755
chan_a_disconnected = false ;
756
756
}
757
757
} ,
758
- 0x12 => {
758
+ 0x0f => {
759
759
if chan_b_disconnected {
760
760
nodes[ 1 ] . peer_connected ( & nodes[ 2 ] . get_our_node_id ( ) , & Init { features : InitFeatures :: empty ( ) } ) ;
761
761
nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & Init { features : InitFeatures :: empty ( ) } ) ;
762
762
chan_b_disconnected = false ;
763
763
}
764
764
} ,
765
- 0x13 => process_msg_events ! ( 0 , true ) ,
766
- 0x14 => process_msg_events ! ( 0 , false ) ,
767
- 0x15 => process_events ! ( 0 , true ) ,
768
- 0x16 => process_events ! ( 0 , false ) ,
769
- 0x17 => process_msg_events ! ( 1 , true ) ,
770
- 0x18 => process_msg_events ! ( 1 , false ) ,
771
- 0x19 => process_events ! ( 1 , true ) ,
772
- 0x1a => process_events ! ( 1 , false ) ,
773
- 0x1b => process_msg_events ! ( 2 , true ) ,
774
- 0x1c => process_msg_events ! ( 2 , false ) ,
775
- 0x1d => process_events ! ( 2 , true ) ,
776
- 0x1e => process_events ! ( 2 , false ) ,
777
- 0x1f => {
765
+
766
+ 0x10 => process_msg_events ! ( 0 , true ) ,
767
+ 0x11 => process_msg_events ! ( 0 , false ) ,
768
+ 0x12 => process_events ! ( 0 , true ) ,
769
+ 0x13 => process_events ! ( 0 , false ) ,
770
+ 0x14 => process_msg_events ! ( 1 , true ) ,
771
+ 0x15 => process_msg_events ! ( 1 , false ) ,
772
+ 0x16 => process_events ! ( 1 , true ) ,
773
+ 0x17 => process_events ! ( 1 , false ) ,
774
+ 0x18 => process_msg_events ! ( 2 , true ) ,
775
+ 0x19 => process_msg_events ! ( 2 , false ) ,
776
+ 0x1a => process_events ! ( 2 , true ) ,
777
+ 0x1b => process_events ! ( 2 , false ) ,
778
+
779
+ 0x1c => {
778
780
if !chan_a_disconnected {
779
781
nodes[ 1 ] . peer_disconnected ( & nodes[ 0 ] . get_our_node_id ( ) , false ) ;
780
782
chan_a_disconnected = true ;
@@ -785,7 +787,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
785
787
nodes[ 0 ] = node_a. clone ( ) ;
786
788
monitor_a = new_monitor_a;
787
789
} ,
788
- 0x20 => {
790
+ 0x1d => {
789
791
if !chan_a_disconnected {
790
792
nodes[ 0 ] . peer_disconnected ( & nodes[ 1 ] . get_our_node_id ( ) , false ) ;
791
793
chan_a_disconnected = true ;
@@ -803,7 +805,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
803
805
nodes[ 1 ] = node_b. clone ( ) ;
804
806
monitor_b = new_monitor_b;
805
807
} ,
806
- 0x21 => {
808
+ 0x1e => {
807
809
if !chan_b_disconnected {
808
810
nodes[ 1 ] . peer_disconnected ( & nodes[ 2 ] . get_our_node_id ( ) , false ) ;
809
811
chan_b_disconnected = true ;
@@ -814,27 +816,67 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
814
816
nodes[ 2 ] = node_c. clone ( ) ;
815
817
monitor_c = new_monitor_c;
816
818
} ,
817
- 0x22 => send_payment_with_secret ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) ) ,
818
- 0x23 => send_payment_with_secret ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) ) ,
819
- 0x25 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 10 ) ,
820
- 0x26 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 10 ) ,
821
- 0x27 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 10 ) ,
822
- 0x28 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 10 ) ,
823
- 0x29 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 10 ) ,
824
- 0x2a => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 10 ) ,
825
- 0x2b => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 1_000 ) ,
826
- 0x2c => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
827
- 0x2d => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
828
- 0x2e => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 1_000 ) ,
829
- 0x2f => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
830
- 0x30 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
831
- 0x31 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 100_000 ) ,
832
- 0x32 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
833
- 0x33 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
834
- 0x34 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 100_000 ) ,
835
- 0x35 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
836
- 0x36 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
837
- // 0x24 defined above
819
+
820
+ // 1/10th the channel size:
821
+ 0x20 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 10_000_000 ) ,
822
+ 0x21 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 10_000_000 ) ,
823
+ 0x22 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 10_000_000 ) ,
824
+ 0x23 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 10_000_000 ) ,
825
+ 0x24 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 10_000_000 ) ,
826
+ 0x25 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 10_000_000 ) ,
827
+
828
+ 0x26 => send_payment_with_secret ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) ) ,
829
+ 0x27 => send_payment_with_secret ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) ) ,
830
+
831
+ 0x28 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 1_000_000 ) ,
832
+ 0x29 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 1_000_000 ) ,
833
+ 0x2a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 1_000_000 ) ,
834
+ 0x2b => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 1_000_000 ) ,
835
+ 0x2c => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 1_000_000 ) ,
836
+ 0x2d => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 1_000_000 ) ,
837
+
838
+ 0x30 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 100_000 ) ,
839
+ 0x31 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
840
+ 0x32 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
841
+ 0x33 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 100_000 ) ,
842
+ 0x34 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
843
+ 0x35 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
844
+
845
+ 0x38 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 10_000 ) ,
846
+ 0x39 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 10_000 ) ,
847
+ 0x3a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 10_000 ) ,
848
+ 0x3b => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 10_000 ) ,
849
+ 0x3c => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 10_000 ) ,
850
+ 0x3d => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 10_000 ) ,
851
+
852
+ 0x40 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 1_000 ) ,
853
+ 0x41 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
854
+ 0x42 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
855
+ 0x43 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 1_000 ) ,
856
+ 0x44 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
857
+ 0x45 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
858
+
859
+ 0x48 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 100 ) ,
860
+ 0x49 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 100 ) ,
861
+ 0x4a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 100 ) ,
862
+ 0x4b => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 100 ) ,
863
+ 0x4c => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 100 ) ,
864
+ 0x4d => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 100 ) ,
865
+
866
+ 0x50 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 10 ) ,
867
+ 0x51 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 10 ) ,
868
+ 0x52 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 10 ) ,
869
+ 0x53 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 10 ) ,
870
+ 0x54 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 10 ) ,
871
+ 0x55 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 10 ) ,
872
+
873
+ 0x58 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 1 ) ,
874
+ 0x59 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 1 ) ,
875
+ 0x5a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 1 ) ,
876
+ 0x5b => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 1 ) ,
877
+ 0x5c => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 1 ) ,
878
+ 0x5d => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 1 ) ,
879
+
838
880
_ => test_return ! ( ) ,
839
881
}
840
882
0 commit comments