@@ -2798,7 +2798,7 @@ async fn get_eth_transaction_receipt(
27982798 ctx : Ctx < impl Blockstore + Send + Sync + ' static > ,
27992799 tx_hash : EthHash ,
28002800 limit : Option < ChainEpoch > ,
2801- ) -> Result < EthTxReceipt , ServerError > {
2801+ ) -> Result < Option < EthTxReceipt > , ServerError > {
28022802 let msg_cid = ctx. chain_store ( ) . get_mapping ( & tx_hash) ?. unwrap_or_else ( || {
28032803 tracing:: debug!(
28042804 "could not find transaction hash {} in Ethereum mapping" ,
@@ -2812,7 +2812,16 @@ async fn get_eth_transaction_receipt(
28122812 . state_manager
28132813 . search_for_message ( None , msg_cid, limit, Some ( true ) )
28142814 . await
2815- . with_context ( || format ! ( "failed to lookup Eth Txn {tx_hash} as {msg_cid}" ) ) ?;
2815+ . with_context ( || format ! ( "failed to lookup Eth Txn {tx_hash} as {msg_cid}" ) ) ;
2816+
2817+ let option = match option {
2818+ Ok ( opt) => opt,
2819+ // Ethereum clients expect an empty response when the message was not found
2820+ Err ( e) => {
2821+ tracing:: debug!( "could not find transaction receipt for hash {tx_hash}: {e}" ) ;
2822+ return Ok ( None ) ;
2823+ }
2824+ } ;
28162825
28172826 let ( tipset, receipt) = option. context ( "not indexed" ) ?;
28182827 let ipld = receipt. return_data ( ) . deserialize ( ) . unwrap_or ( Ipld :: Null ) ;
@@ -2845,7 +2854,7 @@ async fn get_eth_transaction_receipt(
28452854
28462855 let tx_receipt = new_eth_tx_receipt ( & ctx, & parent_ts, & tx, & message_lookup. receipt ) . await ?;
28472856
2848- Ok ( tx_receipt)
2857+ Ok ( Some ( tx_receipt) )
28492858}
28502859
28512860pub enum EthGetTransactionReceipt { }
@@ -2857,7 +2866,7 @@ impl RpcMethod<1> for EthGetTransactionReceipt {
28572866 const API_PATHS : BitFlags < ApiPaths > = ApiPaths :: all_with_v2 ( ) ;
28582867 const PERMISSION : Permission = Permission :: Read ;
28592868 type Params = ( EthHash , ) ;
2860- type Ok = EthTxReceipt ;
2869+ type Ok = Option < EthTxReceipt > ;
28612870 async fn handle (
28622871 ctx : Ctx < impl Blockstore + Send + Sync + ' static > ,
28632872 ( tx_hash, ) : Self :: Params ,
@@ -2875,7 +2884,7 @@ impl RpcMethod<2> for EthGetTransactionReceiptLimited {
28752884 const API_PATHS : BitFlags < ApiPaths > = ApiPaths :: all_with_v2 ( ) ;
28762885 const PERMISSION : Permission = Permission :: Read ;
28772886 type Params = ( EthHash , ChainEpoch ) ;
2878- type Ok = EthTxReceipt ;
2887+ type Ok = Option < EthTxReceipt > ;
28792888 async fn handle (
28802889 ctx : Ctx < impl Blockstore + Send + Sync + ' static > ,
28812890 ( tx_hash, limit) : Self :: Params ,
0 commit comments