finaldata bugfix
This commit is contained in:
@@ -53,7 +53,7 @@ async def get_block(blockhash, *, chain_id=None) -> Block:
|
||||
async def get_block_by_number(height: int, *, chain_id=None) -> Block:
|
||||
if chain_id is None:
|
||||
chain_id = current_chain.get().id
|
||||
response = await current_w3.get().provider.make_request('eth_getBlockByNumber', [height, False])
|
||||
response = await current_w3.get().provider.make_request('eth_getBlockByNumber', [hex(height), False])
|
||||
block = Block(chain_id, response['result'])
|
||||
cache_block(block)
|
||||
return block
|
||||
|
||||
@@ -6,6 +6,7 @@ from typing import Union, Callable
|
||||
|
||||
from dexorder import config, db, now, current_w3
|
||||
from dexorder.base.chain import current_chain
|
||||
from dexorder.blocks import promotion_height
|
||||
from dexorder.blockstate import current_blockstate
|
||||
from dexorder.blockstate.branch import Branch
|
||||
from dexorder.blockstate.fork import Fork, current_fork
|
||||
@@ -45,9 +46,9 @@ class BlockWalker (BlockProgressor):
|
||||
w3 = current_w3.get()
|
||||
chain = current_chain.get()
|
||||
chain_id = chain.id
|
||||
confirm_offset = (config.confirms if config.confirms is not None else chain.confirms) - 1
|
||||
batch_size = config.batch_size if config.batch_size is not None else chain.batch_size
|
||||
current_blockstate.set(FinalizedBlockState())
|
||||
state = FinalizedBlockState()
|
||||
current_blockstate.set(state)
|
||||
|
||||
kv_key = f'walker_height|{chain_id}|{self.name}'
|
||||
with db.session:
|
||||
@@ -73,10 +74,10 @@ class BlockWalker (BlockProgressor):
|
||||
if prev_height is None or latest.height > prev_height:
|
||||
prev_height = latest.height
|
||||
log.debug(f'polled new block {latest.height}')
|
||||
promotion_height = latest.height - confirm_offset
|
||||
while (processed_height < promotion_height and
|
||||
promo_height = promotion_height(chain, latest.height)
|
||||
while (processed_height < promo_height and
|
||||
(config.walker_stop is None or processed_height < config.walker_stop)):
|
||||
cur_height = min(promotion_height, processed_height+batch_size-1)
|
||||
cur_height = min(promo_height, processed_height+batch_size-1)
|
||||
if config.walker_stop is not None:
|
||||
cur_height = min(cur_height, config.walker_stop)
|
||||
await self.handle(processed_height+1, cur_height, chain=chain, w3=w3)
|
||||
|
||||
Reference in New Issue
Block a user