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