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

@@ -288,10 +288,9 @@ class ChainSync:
# Import transactions if provided and apply state changes
if transactions:
for tx_data in transactions:
sender_addr = tx_data.get("sender", "")
payload = tx_data.get("payload", {}) or {}
recipient_addr = payload.get("to") or tx_data.get("recipient", "")
value = int(payload.get("value", 0) or 0)
sender_addr = tx_data.get("from", "")
recipient_addr = tx_data.get("to", "")
value = int(tx_data.get("amount", 0) or 0)
fee = int(tx_data.get("fee", 0) or 0)
tx_hash = tx_data.get("tx_hash", "")