@@ -408,7 +408,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
408
408
409
409
loop {
410
410
macro_rules! send_payment {
411
- ( $source: expr, $dest: expr) => { {
411
+ ( $source: expr, $dest: expr, $amt : expr ) => { {
412
412
let payment_hash = Sha256 :: hash( & [ payment_id; 1 ] ) ;
413
413
payment_id = payment_id. wrapping_add( 1 ) ;
414
414
if let Err ( _) = $source. send_payment( & Route {
@@ -417,15 +417,15 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
417
417
node_features: NodeFeatures :: empty( ) ,
418
418
short_channel_id: $dest. 1 ,
419
419
channel_features: ChannelFeatures :: empty( ) ,
420
- fee_msat: 5000000 ,
420
+ fee_msat: $amt ,
421
421
cltv_expiry_delta: 200 ,
422
422
} ] ] ,
423
423
} , PaymentHash ( payment_hash. into_inner( ) ) , & None ) {
424
424
// Probably ran out of funds
425
425
test_return!( ) ;
426
426
}
427
427
} } ;
428
- ( $source: expr, $middle: expr, $dest: expr) => { {
428
+ ( $source: expr, $middle: expr, $dest: expr, $amt : expr ) => { {
429
429
let payment_hash = Sha256 :: hash( & [ payment_id; 1 ] ) ;
430
430
payment_id = payment_id. wrapping_add( 1 ) ;
431
431
if let Err ( _) = $source. send_payment( & Route {
@@ -441,7 +441,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
441
441
node_features: NodeFeatures :: empty( ) ,
442
442
short_channel_id: $dest. 1 ,
443
443
channel_features: ChannelFeatures :: empty( ) ,
444
- fee_msat: 5000000 ,
444
+ fee_msat: $amt ,
445
445
cltv_expiry_delta: 200 ,
446
446
} ] ] ,
447
447
} , PaymentHash ( payment_hash. into_inner( ) ) , & None ) {
@@ -644,12 +644,12 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
644
644
} ) ;
645
645
for event in events. drain( ..) {
646
646
match event {
647
- events:: Event :: PaymentReceived { payment_hash, payment_secret, .. } => {
647
+ events:: Event :: PaymentReceived { payment_hash, payment_secret, amt } => {
648
648
if claim_set. insert( payment_hash. 0 ) {
649
649
if $fail {
650
650
assert!( nodes[ $node] . fail_htlc_backwards( & payment_hash, & payment_secret) ) ;
651
651
} else {
652
- assert!( nodes[ $node] . claim_funds( PaymentPreimage ( payment_hash. 0 ) , & payment_secret, 5_000_000 ) ) ;
652
+ assert!( nodes[ $node] . claim_funds( PaymentPreimage ( payment_hash. 0 ) , & payment_secret, amt ) ) ;
653
653
}
654
654
}
655
655
} ,
@@ -691,12 +691,12 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
691
691
nodes[ 2 ] . channel_monitor_updated ( & chan_2_funding, * id) ;
692
692
}
693
693
} ,
694
- 0x09 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) ) ,
695
- 0x0a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) ) ,
696
- 0x0b => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) ) ,
697
- 0x0c => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) ) ,
698
- 0x0d => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) ) ,
699
- 0x0e => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) ) ,
694
+ 0x09 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 5_000_000 ) ,
695
+ 0x0a => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 5_000_000 ) ,
696
+ 0x0b => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 5_000_000 ) ,
697
+ 0x0c => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 5_000_000 ) ,
698
+ 0x0d => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 5_000_000 ) ,
699
+ 0x0e => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 5_000_000 ) ,
700
700
0x0f => {
701
701
if !chan_a_disconnected {
702
702
nodes[ 0 ] . peer_disconnected ( & nodes[ 1 ] . get_our_node_id ( ) , false ) ;
@@ -781,6 +781,24 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
781
781
} ,
782
782
0x22 => send_payment_with_secret ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) ) ,
783
783
0x23 => send_payment_with_secret ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) ) ,
784
+ 0x25 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 10 ) ,
785
+ 0x26 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 10 ) ,
786
+ 0x27 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 10 ) ,
787
+ 0x28 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 10 ) ,
788
+ 0x29 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 10 ) ,
789
+ 0x2a => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 10 ) ,
790
+ 0x2b => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 1_000 ) ,
791
+ 0x2c => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
792
+ 0x2d => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
793
+ 0x2e => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 1_000 ) ,
794
+ 0x2f => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 1_000 ) ,
795
+ 0x30 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 1_000 ) ,
796
+ 0x31 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , 100_000 ) ,
797
+ 0x32 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
798
+ 0x33 => send_payment ! ( nodes[ 1 ] , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
799
+ 0x34 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , 100_000 ) ,
800
+ 0x35 => send_payment ! ( nodes[ 0 ] , ( & nodes[ 1 ] , chan_a) , ( & nodes[ 2 ] , chan_b) , 100_000 ) ,
801
+ 0x36 => send_payment ! ( nodes[ 2 ] , ( & nodes[ 1 ] , chan_b) , ( & nodes[ 0 ] , chan_a) , 100_000 ) ,
784
802
// 0x24 defined above
785
803
_ => test_return ! ( ) ,
786
804
}
0 commit comments