File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,27 @@ pub async fn check_tx_status(
3737 . get_receipt ( )
3838 . await
3939 {
40- Ok ( receipt) => Ok ( receipt. into ( ) ) ,
40+ Ok ( receipt) => {
41+ // Check if the receipt has valid block information
42+ if receipt. block_number . is_none ( ) || receipt. block_hash . is_none ( ) || receipt. transaction_index . is_none ( ) {
43+ // Receipt is empty, possibly due to RPC discarding the transaction
44+ match provider. get_transaction_by_hash ( hash) . await {
45+ Ok ( _) => {
46+ // Transaction is still known to the node, so we should wait
47+ Err ( RetryError :: Continue ( eyre ! (
48+ "Received an empty receipt for {hash}, but transaction is still known to the node, waiting for full receipt"
49+ ) ) )
50+ }
51+ Err ( _) => {
52+ // Transaction is not known to the node, mark it as dropped
53+ Ok ( TxStatus :: Dropped )
54+ }
55+ }
56+ } else {
57+ // Receipt has valid block information, proceed normally
58+ Ok ( receipt. into ( ) )
59+ }
60+ }
4161 Err ( e) => match provider. get_transaction_by_hash ( hash) . await {
4262 Ok ( _) => match e {
4363 PendingTransactionError :: TxWatcher ( WatchTxError :: Timeout ) => {
You can’t perform that action at this time.
0 commit comments