consensus: improve block proposal timing and return status, fix transaction field mapping in sync
Some checks failed
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

- 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:
aitbc
2026-04-10 16:10:45 +02:00
parent 632595b0ba
commit 68fa807256
3 changed files with 23 additions and 9 deletions

View File

@@ -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(