@@ -19,7 +19,7 @@ use crate::core::core::transaction::Transaction;
19
19
use crate :: foreign:: Foreign ;
20
20
use crate :: pool:: PoolEntry ;
21
21
use crate :: pool:: { BlockChain , PoolAdapter } ;
22
- use crate :: rest:: ErrorKind ;
22
+ use crate :: rest:: Error ;
23
23
use crate :: types:: {
24
24
BlockHeaderPrintable , BlockPrintable , LocatedTxKernel , OutputListing , OutputPrintable , Tip ,
25
25
Version ,
@@ -126,7 +126,7 @@ pub trait ForeignRpc: Sync + Send {
126
126
height : Option < u64 > ,
127
127
hash : Option < String > ,
128
128
commit : Option < String > ,
129
- ) -> Result < BlockHeaderPrintable , ErrorKind > ;
129
+ ) -> Result < BlockHeaderPrintable , Error > ;
130
130
131
131
/**
132
132
Networked version of [Foreign::get_block](struct.Foreign.html#method.get_block).
@@ -244,7 +244,7 @@ pub trait ForeignRpc: Sync + Send {
244
244
height : Option < u64 > ,
245
245
hash : Option < String > ,
246
246
commit : Option < String > ,
247
- ) -> Result < BlockPrintable , ErrorKind > ;
247
+ ) -> Result < BlockPrintable , Error > ;
248
248
249
249
/**
250
250
Networked version of [Foreign::get_version](struct.Foreign.html#method.get_version).
@@ -277,7 +277,7 @@ pub trait ForeignRpc: Sync + Send {
277
277
# );
278
278
```
279
279
*/
280
- fn get_version ( & self ) -> Result < Version , ErrorKind > ;
280
+ fn get_version ( & self ) -> Result < Version , Error > ;
281
281
282
282
/**
283
283
Networked version of [Foreign::get_tip](struct.Foreign.html#method.get_tip).
@@ -312,7 +312,7 @@ pub trait ForeignRpc: Sync + Send {
312
312
# );
313
313
```
314
314
*/
315
- fn get_tip ( & self ) -> Result < Tip , ErrorKind > ;
315
+ fn get_tip ( & self ) -> Result < Tip , Error > ;
316
316
317
317
/**
318
318
Networked version of [Foreign::get_kernel](struct.Foreign.html#method.get_kernel).
@@ -355,7 +355,7 @@ pub trait ForeignRpc: Sync + Send {
355
355
excess : String ,
356
356
min_height : Option < u64 > ,
357
357
max_height : Option < u64 > ,
358
- ) -> Result < LocatedTxKernel , ErrorKind > ;
358
+ ) -> Result < LocatedTxKernel , Error > ;
359
359
360
360
/**
361
361
Networked version of [Foreign::get_outputs](struct.Foreign.html#method.get_outputs).
@@ -442,7 +442,7 @@ pub trait ForeignRpc: Sync + Send {
442
442
end_height : Option < u64 > ,
443
443
include_proof : Option < bool > ,
444
444
include_merkle_proof : Option < bool > ,
445
- ) -> Result < Vec < OutputPrintable > , ErrorKind > ;
445
+ ) -> Result < Vec < OutputPrintable > , Error > ;
446
446
447
447
/**
448
448
Networked version of [Foreign::get_unspent_outputs](struct.Foreign.html#method.get_unspent_outputs).
@@ -503,7 +503,7 @@ pub trait ForeignRpc: Sync + Send {
503
503
end_index : Option < u64 > ,
504
504
max : u64 ,
505
505
include_proof : Option < bool > ,
506
- ) -> Result < OutputListing , ErrorKind > ;
506
+ ) -> Result < OutputListing , Error > ;
507
507
508
508
/**
509
509
Networked version of [Foreign::get_pmmr_indices](struct.Foreign.html#method.get_pmmr_indices).
@@ -540,7 +540,7 @@ pub trait ForeignRpc: Sync + Send {
540
540
& self ,
541
541
start_block_height : u64 ,
542
542
end_block_height : Option < u64 > ,
543
- ) -> Result < OutputListing , ErrorKind > ;
543
+ ) -> Result < OutputListing , Error > ;
544
544
545
545
/**
546
546
Networked version of [Foreign::get_pool_size](struct.Foreign.html#method.get_pool_size).
@@ -570,7 +570,7 @@ pub trait ForeignRpc: Sync + Send {
570
570
# );
571
571
```
572
572
*/
573
- fn get_pool_size ( & self ) -> Result < usize , ErrorKind > ;
573
+ fn get_pool_size ( & self ) -> Result < usize , Error > ;
574
574
575
575
/**
576
576
Networked version of [Foreign::get_stempool_size](struct.Foreign.html#method.get_stempool_size).
@@ -600,7 +600,7 @@ pub trait ForeignRpc: Sync + Send {
600
600
# );
601
601
```
602
602
*/
603
- fn get_stempool_size ( & self ) -> Result < usize , ErrorKind > ;
603
+ fn get_stempool_size ( & self ) -> Result < usize , Error > ;
604
604
605
605
/**
606
606
Networked version of [Foreign::get_unconfirmed_transactions](struct.Foreign.html#method.get_unconfirmed_transactions).
@@ -673,7 +673,7 @@ pub trait ForeignRpc: Sync + Send {
673
673
# );
674
674
```
675
675
*/
676
- fn get_unconfirmed_transactions ( & self ) -> Result < Vec < PoolEntry > , ErrorKind > ;
676
+ fn get_unconfirmed_transactions ( & self ) -> Result < Vec < PoolEntry > , Error > ;
677
677
678
678
/**
679
679
Networked version of [Foreign::push_transaction](struct.Foreign.html#method.push_transaction).
@@ -738,7 +738,7 @@ pub trait ForeignRpc: Sync + Send {
738
738
# );
739
739
```
740
740
*/
741
- fn push_transaction ( & self , tx : Transaction , fluff : Option < bool > ) -> Result < ( ) , ErrorKind > ;
741
+ fn push_transaction ( & self , tx : Transaction , fluff : Option < bool > ) -> Result < ( ) , Error > ;
742
742
}
743
743
744
744
impl < B , P > ForeignRpc for Foreign < B , P >
@@ -751,45 +751,45 @@ where
751
751
height : Option < u64 > ,
752
752
hash : Option < String > ,
753
753
commit : Option < String > ,
754
- ) -> Result < BlockHeaderPrintable , ErrorKind > {
754
+ ) -> Result < BlockHeaderPrintable , Error > {
755
755
let mut parsed_hash: Option < Hash > = None ;
756
756
if let Some ( hash) = hash {
757
757
let vec = util:: from_hex ( & hash)
758
- . map_err ( |e| ErrorKind :: Argument ( format ! ( "invalid block hash: {}" , e) ) ) ?;
758
+ . map_err ( |e| Error :: Argument ( format ! ( "invalid block hash: {}" , e) ) ) ?;
759
759
parsed_hash = Some ( Hash :: from_vec ( & vec) ) ;
760
760
}
761
- Foreign :: get_header ( self , height, parsed_hash, commit) . map_err ( |e| e . kind ( ) . clone ( ) )
761
+ Foreign :: get_header ( self , height, parsed_hash, commit)
762
762
}
763
763
fn get_block (
764
764
& self ,
765
765
height : Option < u64 > ,
766
766
hash : Option < String > ,
767
767
commit : Option < String > ,
768
- ) -> Result < BlockPrintable , ErrorKind > {
768
+ ) -> Result < BlockPrintable , Error > {
769
769
let mut parsed_hash: Option < Hash > = None ;
770
770
if let Some ( hash) = hash {
771
771
let vec = util:: from_hex ( & hash)
772
- . map_err ( |e| ErrorKind :: Argument ( format ! ( "invalid block hash: {}" , e) ) ) ?;
772
+ . map_err ( |e| Error :: Argument ( format ! ( "invalid block hash: {}" , e) ) ) ?;
773
773
parsed_hash = Some ( Hash :: from_vec ( & vec) ) ;
774
774
}
775
- Foreign :: get_block ( self , height, parsed_hash, commit) . map_err ( |e| e . kind ( ) . clone ( ) )
775
+ Foreign :: get_block ( self , height, parsed_hash, commit)
776
776
}
777
777
778
- fn get_version ( & self ) -> Result < Version , ErrorKind > {
779
- Foreign :: get_version ( self ) . map_err ( |e| e . kind ( ) . clone ( ) )
778
+ fn get_version ( & self ) -> Result < Version , Error > {
779
+ Foreign :: get_version ( self )
780
780
}
781
781
782
- fn get_tip ( & self ) -> Result < Tip , ErrorKind > {
783
- Foreign :: get_tip ( self ) . map_err ( |e| e . kind ( ) . clone ( ) )
782
+ fn get_tip ( & self ) -> Result < Tip , Error > {
783
+ Foreign :: get_tip ( self )
784
784
}
785
785
786
786
fn get_kernel (
787
787
& self ,
788
788
excess : String ,
789
789
min_height : Option < u64 > ,
790
790
max_height : Option < u64 > ,
791
- ) -> Result < LocatedTxKernel , ErrorKind > {
792
- Foreign :: get_kernel ( self , excess, min_height, max_height) . map_err ( |e| e . kind ( ) . clone ( ) )
791
+ ) -> Result < LocatedTxKernel , Error > {
792
+ Foreign :: get_kernel ( self , excess, min_height, max_height)
793
793
}
794
794
795
795
fn get_outputs (
@@ -799,7 +799,7 @@ where
799
799
end_height : Option < u64 > ,
800
800
include_proof : Option < bool > ,
801
801
include_merkle_proof : Option < bool > ,
802
- ) -> Result < Vec < OutputPrintable > , ErrorKind > {
802
+ ) -> Result < Vec < OutputPrintable > , Error > {
803
803
Foreign :: get_outputs (
804
804
self ,
805
805
commits,
@@ -808,7 +808,6 @@ where
808
808
include_proof,
809
809
include_merkle_proof,
810
810
)
811
- . map_err ( |e| e. kind ( ) . clone ( ) )
812
811
}
813
812
814
813
fn get_unspent_outputs (
@@ -817,33 +816,31 @@ where
817
816
end_index : Option < u64 > ,
818
817
max : u64 ,
819
818
include_proof : Option < bool > ,
820
- ) -> Result < OutputListing , ErrorKind > {
819
+ ) -> Result < OutputListing , Error > {
821
820
Foreign :: get_unspent_outputs ( self , start_index, end_index, max, include_proof)
822
- . map_err ( |e| e. kind ( ) . clone ( ) )
823
821
}
824
822
825
823
fn get_pmmr_indices (
826
824
& self ,
827
825
start_block_height : u64 ,
828
826
end_block_height : Option < u64 > ,
829
- ) -> Result < OutputListing , ErrorKind > {
827
+ ) -> Result < OutputListing , Error > {
830
828
Foreign :: get_pmmr_indices ( self , start_block_height, end_block_height)
831
- . map_err ( |e| e. kind ( ) . clone ( ) )
832
829
}
833
830
834
- fn get_pool_size ( & self ) -> Result < usize , ErrorKind > {
835
- Foreign :: get_pool_size ( self ) . map_err ( |e| e . kind ( ) . clone ( ) )
831
+ fn get_pool_size ( & self ) -> Result < usize , Error > {
832
+ Foreign :: get_pool_size ( self )
836
833
}
837
834
838
- fn get_stempool_size ( & self ) -> Result < usize , ErrorKind > {
839
- Foreign :: get_stempool_size ( self ) . map_err ( |e| e . kind ( ) . clone ( ) )
835
+ fn get_stempool_size ( & self ) -> Result < usize , Error > {
836
+ Foreign :: get_stempool_size ( self )
840
837
}
841
838
842
- fn get_unconfirmed_transactions ( & self ) -> Result < Vec < PoolEntry > , ErrorKind > {
843
- Foreign :: get_unconfirmed_transactions ( self ) . map_err ( |e| e . kind ( ) . clone ( ) )
839
+ fn get_unconfirmed_transactions ( & self ) -> Result < Vec < PoolEntry > , Error > {
840
+ Foreign :: get_unconfirmed_transactions ( self )
844
841
}
845
- fn push_transaction ( & self , tx : Transaction , fluff : Option < bool > ) -> Result < ( ) , ErrorKind > {
846
- Foreign :: push_transaction ( self , tx, fluff) . map_err ( |e| e . kind ( ) . clone ( ) )
842
+ fn push_transaction ( & self , tx : Transaction , fluff : Option < bool > ) -> Result < ( ) , Error > {
843
+ Foreign :: push_transaction ( self , tx, fluff)
847
844
}
848
845
}
849
846
@@ -854,7 +851,7 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response {
854
851
// create temporary grin server, run jsonrpc request on node api, delete server, return
855
852
// json response.
856
853
857
- {
854
+ {
858
855
/*use grin_servers::test_framework::framework::run_doctest;
859
856
use grin_util as util;
860
857
use serde_json;
@@ -888,6 +885,6 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response {
888
885
serde_json::to_string_pretty(&expected_response).unwrap()
889
886
);
890
887
}*/
891
- }
888
+ }
892
889
} ;
893
890
}
0 commit comments