@@ -59,7 +59,7 @@ pub trait ForeignRpc {
59
59
}
60
60
}
61
61
# "#
62
- # ,false, 0, TxFlow::Standard);
62
+ # ,false, 0, false, TxFlow::Standard);
63
63
```
64
64
*/
65
65
fn check_version ( & self ) -> Result < VersionInfo , ErrorKind > ;
@@ -107,7 +107,7 @@ pub trait ForeignRpc {
107
107
}
108
108
}
109
109
# "#
110
- # ,false, 4, TxFlow::Standard);
110
+ # ,false, 4, false, TxFlow::Standard);
111
111
```
112
112
*/
113
113
@@ -182,7 +182,7 @@ pub trait ForeignRpc {
182
182
}
183
183
}
184
184
# "#
185
- # ,false, 5, TxFlow::Standard);
185
+ # ,false, 5, true, TxFlow::Standard);
186
186
```
187
187
*/
188
188
fn receive_tx (
@@ -211,10 +211,6 @@ pub trait ForeignRpc {
211
211
"fee": "23500000",
212
212
"id": "0436430c-2b02-624c-2032-570501212b00",
213
213
"off": "d202964900000000d302964900000000d402964900000000d502964900000000",
214
- "proof": {
215
- "raddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3",
216
- "saddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3"
217
- },
218
214
"sigs": [
219
215
{
220
216
"nonce": "02b57c1f4fea69a3ee070309cf8f06082022fe06f25a9be1851b56ef0fa18f25d6",
@@ -237,7 +233,6 @@ pub trait ForeignRpc {
237
233
"result": {
238
234
"Ok": {
239
235
"amt": "6000000000",
240
- "atomic_id": "0",
241
236
"coms": [
242
237
{
243
238
"c": "091582c92b99943b57955e52b5ccf1223780c2a2e55995c00c86fca2bcb46b6b9f",
@@ -247,31 +242,25 @@ pub trait ForeignRpc {
247
242
"fee": "23500000",
248
243
"id": "0436430c-2b02-624c-2032-570501212b00",
249
244
"off": "a4f88ac429dee1d453ae33ed9f944417a52c7310477936e484fd83f0f22db483",
250
- "proof": {
251
- "raddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3",
252
- "rsig": "02357a13b304ba8e22f4896d5664b72ad6d1b824e88782e2b716686ea14ec47281ef5ee14c03ead84c3260f5b0c1529ad3ddae57f28f6b8b1b66532bfcb2ee0f",
253
- "saddr": "32cdd63928854f8b2628b1dce4626ddcdf35d56cb7cfdf7d64cca5822b78d4d3"
254
- },
255
245
"sigs": [
256
246
{
257
247
"nonce": "02b57c1f4fea69a3ee070309cf8f06082022fe06f25a9be1851b56ef0fa18f25d6",
258
248
"xs": "023878ce845727f3a4ec76ca3f3db4b38a2d05d636b8c3632108b857fed63c96de"
259
249
},
260
250
{
261
- "atomic": "03cefcb7f65194418ee236f01638034238a7c996cd73fa9673e0c763eab828f119 ",
251
+ "atomic": "03e1d14f7b440af4944193b0559452651720ecf1847ef0f7092ef7e68414b8d732 ",
262
252
"nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
263
- "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1e25843c36d8bdcf87f208666490a16281943a6504209c3ea53fb9f1f7af0cf8 ",
253
+ "part": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bf9df0f2c4d96d6bb0b2e6e0b94ad6cbbc0e3f9e5582b085b31b5c8bb0e15bd36 ",
264
254
"xs": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f"
265
255
}
266
256
],
267
- "atomic_id": "046d7761746f6d69630000000000000000",
268
257
"sta": "A2",
269
258
"ver": "4:2"
270
259
}
271
260
}
272
261
}
273
262
# "#
274
- # ,false, 5, TxFlow::Atomic);
263
+ # ,false, 5, true, TxFlow::Atomic);
275
264
```
276
265
*/
277
266
fn receive_atomic_tx (
@@ -370,7 +359,7 @@ pub trait ForeignRpc {
370
359
}
371
360
}
372
361
# "#
373
- # ,false, 5, TxFlow::Invoice);
362
+ # ,false, 5, true, TxFlow::Invoice);
374
363
```
375
364
*/
376
365
fn finalize_tx ( & self , slate : VersionedSlate ) -> Result < VersionedSlate , ErrorKind > ;
@@ -451,6 +440,7 @@ pub fn run_doctest_foreign(
451
440
test_dir : & str ,
452
441
use_token : bool ,
453
442
blocks_to_mine : u64 ,
443
+ do_tx : bool ,
454
444
tx_flow : TxFlow ,
455
445
) -> Result < Option < serde_json:: Value > , String > {
456
446
use easy_jsonrpc_mw:: Handler ;
@@ -573,81 +563,84 @@ pub fn run_doctest_foreign(
573
563
assert ! ( wallet_refreshed) ;
574
564
}
575
565
576
- match tx_flow {
577
- TxFlow :: Invoice => {
578
- let amount = 60_000_000_000 ;
579
- let mut slate = {
580
- let mut w_lock = wallet2. lock ( ) ;
566
+ if do_tx {
567
+ match tx_flow {
568
+ TxFlow :: Invoice => {
569
+ let amount = 60_000_000_000 ;
570
+ let mut slate = {
571
+ let mut w_lock = wallet2. lock ( ) ;
572
+ let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
573
+ let args = IssueInvoiceTxArgs {
574
+ amount,
575
+ ..Default :: default ( )
576
+ } ;
577
+ api_impl:: owner:: issue_invoice_tx ( & mut * * w, ( & mask2) . as_ref ( ) , args, true )
578
+ . unwrap ( )
579
+ } ;
580
+ slate = {
581
+ let mut w_lock = wallet1. lock ( ) ;
582
+ let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
583
+ let args = InitTxArgs {
584
+ src_acct_name : None ,
585
+ amount : slate. amount ,
586
+ minimum_confirmations : 2 ,
587
+ max_outputs : 500 ,
588
+ num_change_outputs : 1 ,
589
+ selection_strategy_is_use_all : true ,
590
+ ..Default :: default ( )
591
+ } ;
592
+ api_impl:: owner:: process_invoice_tx (
593
+ & mut * * w,
594
+ ( & mask1) . as_ref ( ) ,
595
+ & slate,
596
+ args,
597
+ true ,
598
+ )
599
+ . unwrap ( )
600
+ } ;
601
+ println ! ( "INIT INVOICE SLATE" ) ;
602
+ // Spit out slate for input to finalize_tx
603
+ println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
604
+ }
605
+ TxFlow :: Standard => {
606
+ let amount = 60_000_000_000 ;
607
+ let mut w_lock = wallet1. lock ( ) ;
581
608
let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
582
- let args = IssueInvoiceTxArgs {
609
+ let args = InitTxArgs {
610
+ src_acct_name : None ,
583
611
amount,
612
+ minimum_confirmations : 2 ,
613
+ max_outputs : 500 ,
614
+ num_change_outputs : 1 ,
615
+ selection_strategy_is_use_all : true ,
584
616
..Default :: default ( )
585
617
} ;
586
- api_impl:: owner:: issue_invoice_tx ( & mut * * w, ( & mask2) . as_ref ( ) , args, true ) . unwrap ( )
587
- } ;
588
- slate = {
618
+ let slate =
619
+ api_impl:: owner:: init_send_tx ( & mut * * w, ( & mask1) . as_ref ( ) , args, true ) . unwrap ( ) ;
620
+ println ! ( "INIT SLATE" ) ;
621
+ // Spit out slate for input to finalize_tx
622
+ println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
623
+ }
624
+ TxFlow :: Atomic => {
625
+ let amount = 60_000_000_000 ;
589
626
let mut w_lock = wallet1. lock ( ) ;
590
627
let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
591
628
let args = InitTxArgs {
592
629
src_acct_name : None ,
593
- amount : slate . amount ,
630
+ amount,
594
631
minimum_confirmations : 2 ,
595
632
max_outputs : 500 ,
596
633
num_change_outputs : 1 ,
597
634
selection_strategy_is_use_all : true ,
598
635
..Default :: default ( )
599
636
} ;
600
- api_impl:: owner:: process_invoice_tx ( & mut * * w, ( & mask1) . as_ref ( ) , & slate, args, true )
601
- . unwrap ( )
602
- } ;
603
- println ! ( "INIT INVOICE SLATE" ) ;
604
- // Spit out slate for input to finalize_tx
605
- println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
606
- }
607
- TxFlow :: Standard => {
608
- let amount = 60_000_000_000 ;
609
- let mut w_lock = wallet1. lock ( ) ;
610
- let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
611
- let args = InitTxArgs {
612
- src_acct_name : None ,
613
- amount,
614
- minimum_confirmations : 2 ,
615
- max_outputs : 500 ,
616
- num_change_outputs : 1 ,
617
- selection_strategy_is_use_all : true ,
618
- ..Default :: default ( )
619
- } ;
620
- let slate =
621
- api_impl:: owner:: init_send_tx ( & mut * * w, ( & mask1) . as_ref ( ) , args, true ) . unwrap ( ) ;
622
- println ! ( "INIT SLATE" ) ;
623
- // Spit out slate for input to finalize_tx
624
- println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
625
- }
626
- TxFlow :: Atomic => {
627
- let amount = 60_000_000_000 ;
628
- let mut w_lock = wallet1. lock ( ) ;
629
- let w = w_lock. lc_provider ( ) . unwrap ( ) . wallet_inst ( ) . unwrap ( ) ;
630
- let args = InitTxArgs {
631
- src_acct_name : None ,
632
- amount,
633
- minimum_confirmations : 2 ,
634
- max_outputs : 500 ,
635
- num_change_outputs : 1 ,
636
- selection_strategy_is_use_all : true ,
637
- ..Default :: default ( )
638
- } ;
639
- let derive_path = 0 ;
640
- let slate = api_impl:: owner:: init_atomic_swap (
641
- & mut * * w,
642
- ( & mask1) . as_ref ( ) ,
643
- args,
644
- derive_path,
645
- true ,
646
- )
647
- . unwrap ( ) ;
648
- println ! ( "INIT SLATE" ) ;
649
- // Spit out slate for input to finalize_tx
650
- println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
637
+ let slate =
638
+ api_impl:: owner:: init_atomic_swap ( & mut * * w, ( & mask1) . as_ref ( ) , args, true )
639
+ . unwrap ( ) ;
640
+ println ! ( "INIT SLATE" ) ;
641
+ // Spit out slate for input to finalize_tx
642
+ println ! ( "{}" , serde_json:: to_string_pretty( & slate) . unwrap( ) ) ;
643
+ }
651
644
}
652
645
}
653
646
@@ -667,7 +660,7 @@ pub fn run_doctest_foreign(
667
660
#[ doc( hidden) ]
668
661
#[ macro_export]
669
662
macro_rules! doctest_helper_json_rpc_foreign_assert_response {
670
- ( $request: expr, $expected_response: expr, $use_token: expr, $blocks_to_mine: expr, $tx_flow: expr) => {
663
+ ( $request: expr, $expected_response: expr, $use_token: expr, $blocks_to_mine: expr, $do_tx : expr , $ tx_flow: expr) => {
671
664
// create temporary wallet, run jsonrpc request on owner api of wallet, delete wallet, return
672
665
// json response.
673
666
// In order to prevent leaking tempdirs, This function should not panic.
@@ -687,9 +680,16 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response {
687
680
let request_val: Value = serde_json:: from_str( $request) . unwrap( ) ;
688
681
let expected_response: Value = serde_json:: from_str( $expected_response) . unwrap( ) ;
689
682
690
- let response = run_doctest_foreign( request_val, dir, $use_token, $blocks_to_mine, $tx_flow)
691
- . unwrap( )
692
- . unwrap( ) ;
683
+ let response = run_doctest_foreign(
684
+ request_val,
685
+ dir,
686
+ $use_token,
687
+ $blocks_to_mine,
688
+ $do_tx,
689
+ $tx_flow,
690
+ )
691
+ . unwrap( )
692
+ . unwrap( ) ;
693
693
694
694
if response != expected_response {
695
695
panic!(
0 commit comments