1
1
#![ allow( clippy:: needless_range_loop) ]
2
+ use crate :: ckb:: contracts:: get_script_by_contract;
3
+ use crate :: ckb:: contracts:: Contract ;
2
4
use crate :: fiber:: channel:: * ;
3
5
use crate :: fiber:: config:: DEFAULT_TLC_EXPIRY_DELTA ;
4
6
use crate :: fiber:: config:: DEFAULT_TLC_FEE_PROPORTIONAL_MILLIONTHS ;
@@ -29,6 +31,12 @@ use std::time::SystemTime;
29
31
use tracing:: debug;
30
32
use tracing:: error;
31
33
34
+ fn get_simple_udt_script ( ) -> Script {
35
+ let args =
36
+ hex:: decode ( "32e555f3ff8e135cece1351a6a2971518392c1e30375c1e006ad0ce8eac07947" ) . unwrap ( ) ;
37
+ get_script_by_contract ( Contract :: SimpleUDT , & args)
38
+ }
39
+
32
40
#[ tokio:: test]
33
41
async fn test_send_payment_custom_records ( ) {
34
42
let ( nodes, _channels) = create_n_nodes_network (
@@ -785,7 +793,7 @@ async fn test_send_payment_hophint_for_mixed_channels_with_udt() {
785
793
node_a_funding_amount : HUGE_CKB_AMOUNT ,
786
794
node_b_funding_amount : HUGE_CKB_AMOUNT ,
787
795
public : true , // not a private channel
788
- funding_udt_type_script : Some ( Script :: default ( ) ) , // a UDT channel
796
+ funding_udt_type_script : Some ( get_simple_udt_script ( ) ) , // a UDT channel
789
797
..Default :: default ( )
790
798
} ,
791
799
) ,
@@ -3135,6 +3143,7 @@ async fn test_send_payment_self_with_two_nodes() {
3135
3143
async fn test_send_payment_self_with_mixed_channel ( ) {
3136
3144
// #678, payself with mixed channel got wrong
3137
3145
init_tracing ( ) ;
3146
+ let udt_script = get_simple_udt_script ( ) ;
3138
3147
3139
3148
let funding_amount = HUGE_CKB_AMOUNT ;
3140
3149
let ( nodes, _channels) = create_n_nodes_network_with_params (
@@ -3154,7 +3163,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3154
3163
public : true ,
3155
3164
node_a_funding_amount : funding_amount,
3156
3165
node_b_funding_amount : funding_amount,
3157
- funding_udt_type_script : Some ( Script :: default ( ) ) ,
3166
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) ,
3158
3167
..Default :: default ( )
3159
3168
} ,
3160
3169
) ,
@@ -3184,7 +3193,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3184
3193
public : true ,
3185
3194
node_a_funding_amount : funding_amount,
3186
3195
node_b_funding_amount : funding_amount,
3187
- funding_udt_type_script : Some ( Script :: default ( ) ) ,
3196
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) ,
3188
3197
..Default :: default ( )
3189
3198
} ,
3190
3199
) ,
@@ -3216,7 +3225,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3216
3225
public : true ,
3217
3226
node_a_funding_amount : funding_amount,
3218
3227
node_b_funding_amount : funding_amount,
3219
- funding_udt_type_script : Some ( Script :: default ( ) ) ,
3228
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) ,
3220
3229
..Default :: default ( )
3221
3230
} ,
3222
3231
) ,
@@ -3226,7 +3235,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3226
3235
public : true ,
3227
3236
node_a_funding_amount : funding_amount,
3228
3237
node_b_funding_amount : funding_amount,
3229
- funding_udt_type_script : Some ( Script :: default ( ) ) ,
3238
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) ,
3230
3239
..Default :: default ( )
3231
3240
} ,
3232
3241
) ,
@@ -3236,7 +3245,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3236
3245
public : true ,
3237
3246
node_a_funding_amount : funding_amount,
3238
3247
node_b_funding_amount : funding_amount,
3239
- funding_udt_type_script : Some ( Script :: default ( ) ) ,
3248
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) ,
3240
3249
..Default :: default ( )
3241
3250
} ,
3242
3251
) ,
@@ -3252,7 +3261,7 @@ async fn test_send_payment_self_with_mixed_channel() {
3252
3261
amount : Some ( 1000 ) ,
3253
3262
keysend : Some ( true ) ,
3254
3263
allow_self_payment : true ,
3255
- udt_type_script : Some ( Script :: default ( ) ) ,
3264
+ udt_type_script : Some ( udt_script . clone ( ) ) ,
3256
3265
..Default :: default ( )
3257
3266
} )
3258
3267
. await ;
@@ -4519,6 +4528,7 @@ async fn test_send_payment_no_preimage_invoice_will_make_payment_failed() {
4519
4528
async fn test_send_payment_with_mixed_channel_hops ( ) {
4520
4529
init_tracing ( ) ;
4521
4530
let _span = tracing:: info_span!( "node" , node = "test" ) . entered ( ) ;
4531
+ let udt_script = get_simple_udt_script ( ) ;
4522
4532
let ( nodes, channels) = create_n_nodes_network (
4523
4533
& [
4524
4534
( ( 0 , 1 ) , ( HUGE_CKB_AMOUNT , HUGE_CKB_AMOUNT ) ) ,
@@ -4537,7 +4547,7 @@ async fn test_send_payment_with_mixed_channel_hops() {
4537
4547
public : false ,
4538
4548
node_a_funding_amount : HUGE_CKB_AMOUNT ,
4539
4549
node_b_funding_amount : HUGE_CKB_AMOUNT ,
4540
- funding_udt_type_script : Some ( Script :: default ( ) ) , // UDT type
4550
+ funding_udt_type_script : Some ( udt_script . clone ( ) ) , // UDT type
4541
4551
..Default :: default ( )
4542
4552
} ,
4543
4553
)
0 commit comments