@@ -180,7 +180,6 @@ impl BitcoindApiClient {
180180 macro_rules! get_raw_transaction {
181181 ( rpc, $rpc_client: expr) => { {
182182 let txid_json = serde_json:: json!( txid_hex) ;
183-
184183 match $rpc_client
185184 . call_method:: <GetRawTransactionResponse >( "getrawtransaction" , & [ txid_json] )
186185 . await
@@ -215,31 +214,42 @@ impl BitcoindApiClient {
215214 } ,
216215 }
217216 } } ;
218-
219217 ( rest, $rest_client: expr) => { {
220218 let tx_path = format!( "tx/{}.json" , txid_hex) ;
221-
222219 match $rest_client
223220 . request_resource:: <JsonResponse , GetRawTransactionResponse >( & tx_path)
224221 . await
225222 {
226223 Ok ( resp) => Ok ( Some ( resp. 0 ) ) ,
227224 Err ( e) => match e. kind( ) {
228225 std:: io:: ErrorKind :: Other => {
229- let http_error_res: Result <Box <HttpError >, _> = e. downcast( ) ;
230- match http_error_res {
231- Ok ( http_error) => {
232- // Check if it's the HTTP NOT_FOUND error code.
233- if & http_error. status_code == "404" {
234- Ok ( None )
235- } else {
236- Err ( std:: io:: Error :: new(
237- std:: io:: ErrorKind :: Other ,
238- http_error,
239- ) )
226+ match e. into_inner( ) {
227+ Some ( inner) => {
228+ let http_error_res: Result <Box <HttpError >, _> =
229+ inner. downcast( ) ;
230+ match http_error_res {
231+ Ok ( http_error) => {
232+ // Check if it's the HTTP NOT_FOUND error code.
233+ if & http_error. status_code == "404" {
234+ Ok ( None )
235+ } else {
236+ Err ( std:: io:: Error :: new(
237+ std:: io:: ErrorKind :: Other ,
238+ http_error,
239+ ) )
240+ }
241+ } ,
242+ Err ( _) => {
243+ let error_msg =
244+ format!( "Failed to process {} response." , tx_path) ;
245+ Err ( std:: io:: Error :: new(
246+ std:: io:: ErrorKind :: Other ,
247+ error_msg. as_str( ) ,
248+ ) )
249+ } ,
240250 }
241251 } ,
242- Err ( _ ) => {
252+ None => {
243253 let error_msg =
244254 format!( "Failed to process {} response." , tx_path) ;
245255 Err ( std:: io:: Error :: new(
0 commit comments