File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
scraper_service/shovel_alpha_to_tao Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change 6
6
table_exists ,
7
7
)
8
8
from shared .exceptions import DatabaseConnectionError , ShovelProcessingError
9
+ from shared .block_metadata import get_block_metadata
9
10
import logging
10
11
11
12
@@ -41,20 +42,11 @@ def do_process_block(self, n):
41
42
raise DatabaseConnectionError (f"Failed to create/check table: { str (e )} " )
42
43
43
44
try :
44
- block_hash = substrate .get_block_hash (n )
45
- block_timestamp = int (
46
- substrate .query (
47
- "Timestamp" ,
48
- "Now" ,
49
- block_hash = block_hash ,
50
- ).serialize ()
51
- / 1000
52
- )
45
+ block_timestamp , block_hash = get_block_metadata (n )
46
+ if block_timestamp == 0 and n != 0 :
47
+ raise ShovelProcessingError (f"Invalid block timestamp (0) for block { n } " )
53
48
except Exception as e :
54
- raise ShovelProcessingError (f"Failed to get block timestamp from substrate: { str (e )} " )
55
-
56
- if block_timestamp == 0 and n != 0 :
57
- raise ShovelProcessingError (f"Invalid block timestamp (0) for block { n } " )
49
+ raise ShovelProcessingError (f"Failed to get block metadata: { str (e )} " )
58
50
59
51
try :
60
52
# Get list of active subnets
You can’t perform that action at this time.
0 commit comments