consensus: improve block proposal timing and return status, fix transaction field mapping in sync
- Add initial sleep before first proposal to prevent immediate block creation - Return bool from _propose_block to indicate if block was actually proposed - Wait for next slot only after successful proposal, use regular interval after skipped proposals - Add 1s sleep after proposal errors to prevent tight error loops - Add parent_hash, proposer, and state_root fields to /rpc/blocks-range response - Fix transaction field mapping
This commit is contained in:
@@ -254,10 +254,13 @@ async def get_blocks_range(start: int = 0, end: int = 10, include_tx: bool = Tru
|
||||
block_data = {
|
||||
"height": b.height,
|
||||
"hash": b.hash,
|
||||
"parent_hash": b.parent_hash,
|
||||
"proposer": b.proposer,
|
||||
"timestamp": b.timestamp.isoformat(),
|
||||
"tx_count": b.tx_count,
|
||||
"state_root": b.state_root,
|
||||
}
|
||||
|
||||
|
||||
if include_tx:
|
||||
# Fetch transactions for this block
|
||||
txs = session.exec(
|
||||
|
||||
Reference in New Issue
Block a user